This commit is contained in:
Adam Sawicki 2020-11-03 17:24:26 +01:00
commit 8cd86b6dd4

View File

@ -4749,7 +4749,7 @@ static IterT VmaBinaryFindFirstNotLess(IterT beg, IterT end, const KeyT &key, co
size_t down = 0, up = (end - beg); size_t down = 0, up = (end - beg);
while(down < up) while(down < up)
{ {
const size_t mid = (down + up) / 2; const size_t mid = down + (up - down) / 2; // Overflow-safe midpoint calculation
if(cmp(*(beg+mid), key)) if(cmp(*(beg+mid), key))
{ {
down = mid + 1; down = mid + 1;