This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: another unsigned shift fix
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 20 Dec 2005 18:23:51 -0700
- Subject: [gcjx] Patch: FYI: another unsigned shift fix
- Reply-to: tromey at redhat dot com
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.