From: uz Date: Sun, 1 Jan 2012 18:26:39 +0000 (+0000) Subject: Fixed a bug: To check for signed types use IsSignSigned, not !IsSignUnsigned. X-Git-Tag: V2.13.3~111 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0692c66db39f52083620afd79acb3c9d17a4d333;p=cc65 Fixed a bug: To check for signed types use IsSignSigned, not !IsSignUnsigned. The latter may be true for types and are neither signed nor unsigned. git-svn-id: svn://svn.cc65.org/cc65/trunk@5353 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/typeconv.c b/src/cc65/typeconv.c index d26ba32b2..ecde7349f 100644 --- a/src/cc65/typeconv.c +++ b/src/cc65/typeconv.c @@ -128,7 +128,7 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType) Expr->IVal &= (0xFFFFFFFFUL >> (32 - NewBits)); /* If the new type is signed, sign extend the value */ - if (!IsSignUnsigned (NewType)) { + if (IsSignSigned (NewType)) { if (Expr->IVal & (0x01UL << (NewBits-1))) { /* Beware: Use the safe shift routine here. */ Expr->IVal |= shl_l (~0UL, NewBits);