This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Another BigInteger bug.
- To: "'java-patches at gcc dot gnu dot org'" <java-patches at gcc dot gnu dot org>
- Subject: Another BigInteger bug.
- From: "Boehm, Hans" <hans_boehm at hp dot com>
- Date: Thu, 16 Aug 2001 16:23:44 -0700
Right shifts of negative numbers by nonzero multiples of 32 generally
produced the wrong answer. This seems to be yet another case where the code
assumed that left shifting an int by 32 produced 0.
OK to commit to the trunk?
Hans
* BigInteger.java: fix right shifts by nonzero multiples of 32.
Index: BigInteger.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/math/BigInteger.java,v
retrieving revision 1.12
diff -u -r1.12 BigInteger.java
--- BigInteger.java 2001/06/19 11:42:03 1.12
+++ BigInteger.java 2001/08/16 22:58:19
@@ -1397,7 +1397,7 @@
realloc(d_len);
MPN.rshift0 (words, x.words, word_count, d_len, count);
ival = d_len;
- if (neg)
+ if (neg && count != 0)
words[d_len-1] |= -1 << (32 - count);
}
}