mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std: Avoid overflowing in the midpoint calculation in upperBound
This commit is contained in:
parent
0039cb7ef2
commit
d6eac43a5b
1 changed files with 1 additions and 1 deletions
|
|
@ -616,7 +616,7 @@ pub fn upperBound(
|
|||
var right: usize = items.len;
|
||||
|
||||
while (left < right) {
|
||||
const mid = (right + left) / 2;
|
||||
const mid = left + (right - left) / 2;
|
||||
if (!lessThan(context, key, items[mid])) {
|
||||
left = mid + 1;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue