aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2023-12-07 18:26:34 +0100
committerGitHub <noreply@github.com>2023-12-07 18:26:34 +0100
commit040b90ce76f797e7cf7201c12a6115bf56a557ab (patch)
treec742392bb81753f3c089a252ad0ce21596752279
parent31b1aef44e1b0178f10f5faa62ceedddda56667b (diff)
parent843b2350eb11d61084c7af40f347b47eed8f98f0 (diff)
Merge pull request #3011 from xtactis/binary_search_by_fix/3007
Fix for bug in binary_search_by implementation
-rw-r--r--core/slice/slice.odin4
1 files changed, 1 insertions, 3 deletions
diff --git a/core/slice/slice.odin b/core/slice/slice.odin
index 9722150a5..748bd28f7 100644
--- a/core/slice/slice.odin
+++ b/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]