From 7bce0b4f0c6dc3c362117a7d98bb51e5674a6383 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 1 Mar 2017 17:07:05 +0100 Subject: [PATCH] Fix warning with ubsan and -Wconversion This fixes a compiler warning about a lossy conversion from long unsigned int to int when compiling unity with gcc 6.3.1 and the options -std=c89 -Wconversion -fsanitize=undefined --- src/unity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unity.c b/src/unity.c index 1fcf3f3..5266364 100644 --- a/src/unity.c +++ b/src/unity.c @@ -194,7 +194,7 @@ void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print) while (nibbles > 0) { nibbles--; - nibble = (number >> (nibbles * 4)) & 0x0F; + nibble = (int)(number >> (nibbles * 4)) & 0x0F; if (nibble <= 9) { UNITY_OUTPUT_CHAR((char)('0' + nibble));