added #no_bounds_check back into binary_search_by

This commit is contained in:
Matija Dizdar
2023-12-06 21:48:37 +01:00
parent 526d338300
commit 843b2350eb
+1 -2
View File
@@ -170,8 +170,7 @@ binary_search :: proc(array: $A/[]$T, key: T) -> (index: int, found: bool)
}
@(require_results)
binary_search_by :: proc(array: $A/[]$T, key: T, f: proc(T, T) -> Ordering) -> (index: int, found: bool)
{
binary_search_by :: proc(array: $A/[]$T, key: T, f: proc(T, T) -> Ordering) -> (index: int, found: bool) #no_bounds_check {
// INVARIANTS:
// - 0 <= left <= (left + size = right) <= len(array)
// - f returns .Less for everything in array[:left]