From: bernhardheld Date: Thu, 31 Jul 2003 10:59:47 +0000 (+0000) Subject: 3. fix, this time for Alpha; ULONG has 64 bits there, while the mantissa of a double... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=2cc4017439441dbe210e4bf83a4d68f5b3d86339;p=fw%2Fsdcc 3. fix, this time for Alpha; ULONG has 64 bits there, while the mantissa of a double is "only" 53 bits wide git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2789 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 6392e53c..1e3b1582 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-07-31 Bernhard Held + + * src/SDCCicode.c (operandOperation): 3. fix, this time for Alpha; ULONG has 64 bits + there, while the mantissa of a double is "only" 53 bits wide. + 2003-07-30 Jesus Calvino-Fraga Adding sdcclib to the build. MSVC project coming soon. diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 7eea91c0..f368ac4e 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -1064,7 +1064,7 @@ operandOperation (operand * left, operand * right, operandLitValue (right))); break; case '/': - if ((unsigned long) operandLitValue (right) == 0) + if ((TYPE_UDWORD) operandLitValue (right) == 0) { werror (E_DIVIDE_BY_ZERO); retval = right; @@ -1076,26 +1076,26 @@ operandOperation (operand * left, operand * right, operandLitValue (right))); break; case '%': - if ((unsigned long) operandLitValue (right) == 0) { + if ((TYPE_UDWORD) operandLitValue (right) == 0) { werror (E_DIVIDE_BY_ZERO); retval = right; } else retval = operandFromLit ((SPEC_USIGN(let) ? - (unsigned long) operandLitValue (left) : - (long) operandLitValue (left)) % + (TYPE_UDWORD) operandLitValue (left) : + (TYPE_DWORD) operandLitValue (left)) % (SPEC_USIGN(ret) ? - (unsigned long) operandLitValue (right) : - (long) operandLitValue (right))); + (TYPE_UDWORD) operandLitValue (right) : + (TYPE_DWORD) operandLitValue (right))); break; case LEFT_OP: retval = operandFromLit ((SPEC_USIGN(let) ? - (unsigned long) operandLitValue (left) : - (long) operandLitValue (left)) << + (TYPE_UDWORD) operandLitValue (left) : + (TYPE_UDWORD) operandLitValue (left)) << (SPEC_USIGN(ret) ? - (unsigned long) operandLitValue (right) : - (long) operandLitValue (right))); + (TYPE_UDWORD) operandLitValue (right) : + (TYPE_UDWORD) operandLitValue (right))); break; case RIGHT_OP: { double lval = operandLitValue(left), rval = operandLitValue(right); @@ -1103,16 +1103,16 @@ operandOperation (operand * left, operand * right, switch ((SPEC_USIGN(let) ? 2 : 0) + (SPEC_USIGN(ret) ? 1 : 0)) { case 0: // left=unsigned right=unsigned - res=(unsigned long)lval >> (unsigned long)rval; + res=(TYPE_UDWORD)lval >> (TYPE_UDWORD)rval; break; case 1: // left=unsigned right=signed - res=(unsigned long)lval >> (signed long)rval; + res=(TYPE_UDWORD)lval >> (TYPE_DWORD)rval; break; case 2: // left=signed right=unsigned - res=(signed long)lval >> (unsigned long)rval; + res=(TYPE_DWORD)lval >> (TYPE_UDWORD)rval; break; case 3: // left=signed right=signed - res=(signed long)lval >> (signed long)rval; + res=(TYPE_DWORD)lval >> (TYPE_DWORD)rval; break; } retval = operandFromLit (res); @@ -1144,18 +1144,18 @@ operandOperation (operand * left, operand * right, break; case BITWISEAND: retval = operandFromValue (valCastLiteral (type, - (unsigned long)operandLitValue(left) & - (unsigned long)operandLitValue(right))); + (TYPE_UDWORD)operandLitValue(left) & + (TYPE_UDWORD)operandLitValue(right))); break; case '|': retval = operandFromValue (valCastLiteral (type, - (unsigned long)operandLitValue(left) | - (unsigned long)operandLitValue(right))); + (TYPE_UDWORD)operandLitValue(left) | + (TYPE_UDWORD)operandLitValue(right))); break; case '^': retval = operandFromValue (valCastLiteral (type, - (unsigned long)operandLitValue(left) ^ - (unsigned long)operandLitValue(right))); + (TYPE_UDWORD)operandLitValue(left) ^ + (TYPE_UDWORD)operandLitValue(right))); break; case AND_OP: retval = operandFromLit (operandLitValue (left) && @@ -1167,7 +1167,7 @@ operandOperation (operand * left, operand * right, break; case RRC: { - unsigned long i = (unsigned long) operandLitValue (left); + TYPE_UDWORD i = (TYPE_UDWORD) operandLitValue (left); retval = operandFromLit ((i >> (getSize (operandType (left)) * 8 - 1)) | (i << 1)); @@ -1175,7 +1175,7 @@ operandOperation (operand * left, operand * right, break; case RLC: { - unsigned long i = (unsigned long) operandLitValue (left); + TYPE_UDWORD i = (TYPE_UDWORD) operandLitValue (left); retval = operandFromLit ((i << (getSize (operandType (left)) * 8 - 1)) | (i >> 1)); @@ -1187,7 +1187,7 @@ operandOperation (operand * left, operand * right, break; case '~': - retval = operandFromLit (~((unsigned long) operandLitValue (left))); + retval = operandFromLit (~((TYPE_UDWORD) operandLitValue (left))); break; case '!':