BigInteger(byte[]) constructor bugfix.

Mark J. Roberts mjr@statesmean.com
Sun Apr 1 17:06:00 GMT 2001


On 1 Apr 2001, Tom Tromey wrote:

> >>>>> "Mark" == Mark J Roberts <mjr@statesmean.com> writes:
>
> Mark> Err, sorry -- the above inserted if statement was our first fix
> Mark> for this problem, but later the whole line seemed
> Mark> superfluous. My bad.
>
> Could you send the output of `diff -u' between the current cvs version
> and your fixed version?  If you are using the cvs checkout out can use
> `cvs diff -u' to get this.  That would be easiest...

mjr::math$ cvs diff -u  BigInteger.java
Index: BigInteger.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/math/BigInteger.java,v
retrieving revision 1.10.4.1
diff -u -r1.10.4.1 BigInteger.java
--- BigInteger.java     2001/03/03 07:27:59     1.10.4.1
+++ BigInteger.java     2001/04/02 00:05:33
@@ -220,12 +220,8 @@
   private static int[] byteArrayToIntArray(byte[] bytes, int sign)
   {
     // Determine number of words needed.
-    int[] words = new int[(bytes.length + 3) / 4 + 1];
+    int[] words = new int[bytes.length/4 + 1];
     int nwords = words.length;
-
-    // For simplicity, tack on an extra word of sign at the front,
-    // it will be canonicalized out later. */
-    words[--nwords] = sign;

     // Create a int out of modulo 4 high order bytes.
     int bptr = 0;



-- 
Satan, oscillate my metallic sonatas!
Mark Roberts | mjr@statesmean.com



More information about the Java mailing list