From 06be409256fd33bfd35f4cc67fee59e2bb11439b Mon Sep 17 00:00:00 2001 From: redcode Date: Thu, 18 Oct 2018 09:26:21 +0200 Subject: [PATCH] Suppression of warnings related to implicit conversion of signedness in Clang (-Weverything) --- sources/Z80.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/Z80.c b/sources/Z80.c index 9613f1f..fe3c800 100644 --- a/sources/Z80.c +++ b/sources/Z80.c @@ -178,12 +178,12 @@ static zuint8 const pf_parity_table[256] = { #define PF_PARITY(value) pf_parity_table[value] -#define VF(function, operand) \ -static Z_INLINE zuint8 pf_overflow_##function##8(zsint8 a, zsint8 b) \ - { \ - zsint total = ((zsint)a) operand ((zsint)b); \ - \ - return total < -128 || total > 127 ? PF : 0; \ +#define VF(function, operand) \ +static Z_INLINE zuint8 pf_overflow_##function##8(zuint8 a, zuint8 b) \ + { \ + zsint total = ((zsint)((zsint8)a)) operand ((zsint)((zsint8)b)); \ + \ + return total < -128 || total > 127 ? PF : 0; \ } VF(add, +) @@ -191,9 +191,9 @@ VF(sub, -) #undef VF #define VF(function, bits, type, operand, minimum, maximum) \ -static Z_INLINE zuint8 pf_overflow_##function##bits(zsint##bits a, zsint##bits b, zuint8 carry) \ +static Z_INLINE zuint8 pf_overflow_##function##bits(zuint##bits a, zuint##bits b, zuint8 carry) \ { \ - type total = ((type)a) operand ((type)b) operand carry; \ + type total = ((type)((zsint##bits)a)) operand ((type)((zsint##bits)b)) operand carry; \ \ return total < minimum || total > maximum ? PF : 0; \ }