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
commit fcad25e26a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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;