Fixed-point values can use all 32-Q magnitude bits (#1085)

This commit is contained in:
Rangi
2022-10-02 05:08:38 -04:00
committed by GitHub
parent ab12c474d2
commit 8553b61a94
4 changed files with 294 additions and 28 deletions

View File

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