[gcjx] Patch: FYI: another unsigned shift fix

Tom Tromey tromey@redhat.com
Wed Dec 21 01:29:00 GMT 2005


I'm checking this in on the gcjx branch.

My previous patch to constant unsigned right shifts introduced a bug,
caught by the auto-tester.

Fixed as appended.  This time I actually ran jacks.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* model/primitive.hh (unsigned_right_shift): Mask relevant bits.

Index: model/primitive.hh
===================================================================
--- model/primitive.hh	(revision 108828)
+++ model/primitive.hh	(working copy)
@@ -458,7 +458,14 @@
   {
     // Only 'long' and 'int' shifts are supported.
     assert (sig_char == 'I' || sig_char == 'J');
+
+    // Gross twiddling to get a usable mask.
+    unsigned long long mask = (unsigned long long) MAX;
+    mask = (mask << 1) | 1;
+
     unsigned long long lval = (unsigned long long) (T) l;
+    lval &= mask;
+
     unsigned long long rval = (unsigned long long) (T) r;
     // This is a little ugly -- there should be a way to compute the
     // mask.



More information about the Java-patches mailing list