Fix undefined behavior when printing INT_MIN/INT64_MIN.
Negating the most-negative signed integer results in overflow, which
is undefined behavior.  Fix this by casting to an unsigned type first
(unsigned overflow is well-defined as it uses modular arithmetic).
@@ -183,7 +183,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;
}
UnityPrintNumberUnsigned(number);
}
