mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
variable.c: improve binary search logic in bsearch_idx
Co-authored-by: Gemini <gemini@google.com>
This commit is contained in:
+1
-1
@@ -88,7 +88,7 @@ bsearch_idx(mrb_sym *keys, int size, mrb_sym target) {
|
||||
n -= half;
|
||||
}
|
||||
/* Final adjustment: if the remaining element is still less than target, advance by one */
|
||||
return (int)(p - keys) + (keys[0] < target);
|
||||
return (int)(p - keys) + (p[0] < target);
|
||||
}
|
||||
|
||||
/* Set (insert or update) the value for `sym` in the instance variable table using branch-free search. */
|
||||
|
||||
Reference in New Issue
Block a user