1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Fix strict-overflow compiler warning

By replacing "x < y + 1" with "x <= y" the compiler doesn't have to do
it and the warning "assuming signed overflow does not occur when
reducing constant in comparison [-Werror=strict-overflow]" is avoided.
This commit is contained in:
Erik Flodin
2021-04-17 19:00:06 +02:00
parent 8e1e9c18ab
commit dc96c3e6dd

View File

@@ -445,7 +445,7 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
/* build up buffer in reverse order */
digits = 0;
while ((n != 0) || (digits < (decimals + 1)))
while ((n != 0) || (digits <= decimals))
{
buf[digits++] = (char)('0' + n % 10);
n /= 10;