1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00

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
This commit is contained in:
uz 2012-01-01 18:26:39 +00:00
parent 9c841c19c8
commit 0692c66db3

View File

@ -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);