Ensure 'mid' is always initialized.

This commit is contained in:
Atgeirr Flø Rasmussen 2024-06-07 14:27:02 +02:00
parent 302503e172
commit 71684bfe2c

View File

@ -286,10 +286,9 @@ namespace
// we binary search over
int left = rowIndices[col];
int right = rowIndices[col + 1] - 1;
int mid;
int mid = left + (right - left) / 2; // overflow-safe average;
while (left <= right) {
mid = left + (right - left) / 2; // overflow-safe average
const int col = colIndices[mid];
if (col == naturalRowIdx) {
@ -299,6 +298,7 @@ namespace
} else {
right = mid - 1;
}
mid = left + (right - left) / 2; // overflow-safe average
}
const int symOpposite = mid;