This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: BigInteger.modPow bug? (was: Freenet compilation errors.)
- To: "Boehm, Hans" <hans_boehm at hp dot com>
- Subject: Re: BigInteger.modPow bug? (was: Freenet compilation errors.)
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Wed, 17 Jan 2001 14:03:38 +1300
- CC: "'Warren Levy'" <warrenl at redhat dot com>, "Mark J. Roberts" <mjr at statesmean dot com>, java-patches at sources dot redhat dot com
- References: <140D21516EC2D3119EE700902787664401E3A82A@hplex1.hpl.hp.com>
"Boehm, Hans" wrote:
> Here is a patch for the problem I was observing. Unfortunately, that seems
> to be different from the mod problem reported below.
Thanks. I'm checking this in w/ Changelog entry and formatting fixes.
regards
[ bryce ]
2001-01-16 Hans Boehm <hans_boehm@hp.com>
* java/math/BigInteger.java (setShiftRight): Only do negative shift
if count != 0.
Index: java/math/BigInteger.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/math/BigInteger.java,v
retrieving revision 1.8
diff -u -r1.8 BigInteger.java
--- BigInteger.java 2000/10/27 10:33:46 1.8
+++ BigInteger.java 2001/01/17 00:58:40
@@ -1401,11 +1401,13 @@
realloc(d_len);
if (count == 0)
System.arraycopy(x.words, word_count, words, 0, d_len);
- else
- MPN.rshift(words, x.words, word_count, d_len, count);
+ else
+ {
+ MPN.rshift(words, x.words, word_count, d_len, count);
+ if (neg)
+ words[d_len-1] |= -1 << (32 - count);
+ }
ival = d_len;
- if (neg)
- words[ival-1] |= -1 << (32 - count);
}
}
}