Another BigInteger bug.
Boehm, Hans
hans_boehm@hp.com
Thu Aug 16 16:23:00 GMT 2001
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);
}
}
More information about the Java-patches
mailing list