1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-29 03:04:27 +01:00

Get the 2's compliment of the unsigned int number when printing results without relying on problematic recasting of a negated int. (see #439)

This commit is contained in:
Mark VanderVoord
2019-09-10 15:52:37 -04:00
parent 2939c420ed
commit 46263fc148

View File

@@ -327,7 +327,7 @@ void UnityPrintNumber(const UNITY_INT number_to_print)
{ {
/* A negative number, including MIN negative */ /* A negative number, including MIN negative */
UNITY_OUTPUT_CHAR('-'); UNITY_OUTPUT_CHAR('-');
number = (UNITY_UINT)-number_to_print; number = (~number) + 1;
} }
UnityPrintNumberUnsigned(number); UnityPrintNumberUnsigned(number);
} }