< prev index next >

src/hotspot/share/opto/mulnode.cpp

Print this page

        

@@ -195,18 +195,18 @@
     sign_flip = true;
   }
 
   // Get low bit; check for being the only bit
   Node *res = NULL;
-  unsigned int bit1 = abs_con & -abs_con;       // Extract low bit
+  unsigned int bit1 = abs_con & (0-abs_con);       // Extract low bit
   if (bit1 == abs_con) {           // Found a power of 2?
     res = new LShiftINode(in(1), phase->intcon(log2_intptr(bit1)));
   } else {
 
     // Check for constant with 2 bits set
     unsigned int bit2 = abs_con-bit1;
-    bit2 = bit2 & -bit2;          // Extract 2nd bit
+    bit2 = bit2 & (0-bit2);          // Extract 2nd bit
     if (bit2 + bit1 == abs_con) {    // Found all bits in con?
       Node *n1 = phase->transform( new LShiftINode(in(1), phase->intcon(log2_intptr(bit1))));
       Node *n2 = phase->transform( new LShiftINode(in(1), phase->intcon(log2_intptr(bit2))));
       res = new AddINode(n2, n1);
 

@@ -291,18 +291,18 @@
     sign_flip = true;
   }
 
   // Get low bit; check for being the only bit
   Node *res = NULL;
-  unsigned long bit1 = abs_con & -abs_con;      // Extract low bit
+  unsigned long bit1 = abs_con & (0-abs_con);      // Extract low bit
   if (bit1 == abs_con) {           // Found a power of 2?
     res = new LShiftLNode(in(1), phase->intcon(log2_long(bit1)));
   } else {
 
     // Check for constant with 2 bits set
     unsigned long bit2 = abs_con-bit1;
-    bit2 = bit2 & -bit2;          // Extract 2nd bit
+    bit2 = bit2 & (0-bit2);          // Extract 2nd bit
     if (bit2 + bit1 == abs_con) {    // Found all bits in con?
       Node *n1 = phase->transform(new LShiftLNode(in(1), phase->intcon(log2_long(bit1))));
       Node *n2 = phase->transform(new LShiftLNode(in(1), phase->intcon(log2_long(bit2))));
       res = new AddLNode(n2, n1);
 
< prev index next >