Browse Source

Merge pull request #3011 from xtactis/binary_search_by_fix/3007

Fix for bug in binary_search_by implementation
Jeroen van Rijn 1 year ago
parent
commit
040b90ce76
1 changed files with 1 additions and 3 deletions
  1. 1 3
      core/slice/slice.odin

+ 1 - 3
core/slice/slice.odin

@@ -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]