fixed bug #524685
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Mar 2002 10:52:53 +0000 (10:52 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Mar 2002 10:52:53 +0000 (10:52 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1985 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCicode.c

index d609f377ad4582ac820302218fb2ba2302a89bc3..dd8dca5fb4a8f53bf6075bea9f3a63f4e7f3a597 100644 (file)
@@ -1904,10 +1904,12 @@ geniCodeDivision (operand * left, operand * right)
 
   resType = usualBinaryConversions (&left, &right);
 
-  /* if the right is a literal & power of 2 */
-  /* then make it a right shift             */
+  /* if the right is a literal & power of 2 
+     and left is unsigned then make it a    
+     right shift */
   if (IS_LITERAL (retype) &&
       !IS_FLOAT (letype) &&
+      SPEC_USIGN(letype) &&
       (p2 = powof2 ((unsigned long)
                    floatFromVal (right->operand.valOperand)))) {
     ic = newiCode (RIGHT_OP, left, operandFromLit (p2)); /* right shift */