Commit 444811c0 by olly Committed by Oliver Woodman

Don't overflow when dealing with large segment numbers

Issue: #2311

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=144182445
parent ce03b8c2
......@@ -143,7 +143,7 @@ public abstract class SegmentBase {
} else {
// The high index cannot be unbounded. Identify the segment using binary search.
while (lowIndex <= highIndex) {
int midIndex = (lowIndex + highIndex) / 2;
int midIndex = lowIndex + (highIndex - lowIndex) / 2;
long midTimeUs = getSegmentTimeUs(midIndex);
if (midTimeUs < timeUs) {
lowIndex = midIndex + 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment