This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] Patch: FYI: another unsigned shift fix


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]