From 46263fc148909cd0a4c8c2f218129ea9b3100cbe Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Tue, 10 Sep 2019 15:52:37 -0400 Subject: [PATCH] Get the 2's compliment of the unsigned int `number` when printing results without relying on problematic recasting of a negated int. (see #439) --- src/unity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unity.c b/src/unity.c index 660bfd6..9883fd7 100644 --- a/src/unity.c +++ b/src/unity.c @@ -327,7 +327,7 @@ void UnityPrintNumber(const UNITY_INT number_to_print) { /* A negative number, including MIN negative */ UNITY_OUTPUT_CHAR('-'); - number = (UNITY_UINT)-number_to_print; + number = (~number) + 1; } UnityPrintNumberUnsigned(number); } -- GitLab