Merge pull request #5420 from atgeirr/avoid-uninitialized-variable

Ensure 'mid' is always initialized.
This commit is contained in:
Bård Skaflestad
2024-06-07 17:14:58 +02:00
committed by GitHub

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;