3. fix, this time for Alpha; ULONG has 64 bits there, while the mantissa of a double...
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 31 Jul 2003 10:59:47 +0000 (10:59 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 31 Jul 2003 10:59:47 +0000 (10:59 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2789 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCicode.c

index 6392e53c21b892d1d59eafbcadd0ec0bc3194e6a..1e3b1582848fd2fc5abaf4302e7d6166f4f7cdfe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-31  Bernhard Held <bernhard@bernhardheld.de>
+
+       * 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 <jesusc@ece.ubc.ca>
 
        Adding sdcclib to the build.  MSVC project coming soon.
index 7eea91c05e319efb8672eaeb546a19939c3ceaeb..f368ac4ed66635f101e6e749bf66748683510528 100644 (file)
@@ -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 '!':