Allow fixed-point constants to have unsigned range (#1084)

For example with Q.4, $F0 is 15.0, which no longer warns
This commit is contained in:
Rangi
2022-10-01 17:32:34 -04:00
committed by GitHub
parent a1107fc5cf
commit 106ad30e5a
5 changed files with 30 additions and 3 deletions

View File

@@ -1179,7 +1179,7 @@ static uint32_t readFractionalPart(uint32_t integer)
precision = fixPrecision;
}
if (integer >= ((uint32_t)1 << (precision - 1)))
if (integer >= ((uint64_t)1 << precision))
warning(WARNING_LARGE_CONSTANT, "Magnitude of fixed-point constant is too large\n");
// Cast to unsigned avoids undefined overflow behavior