mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std: Avoid overflowing in the midpoint calculation in upperBound
This commit is contained in:
parent
b5e99b5295
commit
3518d22d56
@ -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…
x
Reference in New Issue
Block a user