Skip to content

Commit

Permalink
Merge pull request #3011 from xtactis/binary_search_by_fix/3007
Browse files Browse the repository at this point in the history
Fix for bug in binary_search_by implementation
  • Loading branch information
Kelimion authored Dec 7, 2023
2 parents 31b1aef + 843b235 commit 040b90c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/slice/slice.odin
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +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)
where intrinsics.type_is_ordered(T) #no_bounds_check
{
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]
Expand Down

0 comments on commit 040b90c

Please sign in to comment.