[MLton-commit] r4513

Stephen Weeks MLton@mlton.org
Tue, 9 May 2006 19:49:06 -0700


Quelled gcc warning "right shift count >= width of type".


----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c	2006-05-10 02:29:29 UTC (rev 4512)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c	2006-05-10 02:49:06 UTC (rev 4513)
@@ -65,7 +65,13 @@
       }
       for (unsigned int i = 0; i < LIMBS_PER_OBJPTR; i++) {
         space[i] = (mp_limb_t)arg;
-        arg = arg >> (CHAR_BIT * sizeof(mp_limb_t));
+        // The conditional below is to quell a gcc warning:
+        //   right shift count >= width of type
+        // When 1 == LIMBS_PEROBJPTR, the for loop will not continue, so the
+        // shift doesn't matter.
+        arg = arg >> (1 == LIMBS_PER_OBJPTR ?
+                        0 :
+                        CHAR_BIT * sizeof(mp_limb_t));
       }
     }
   } else {