This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: java.math.BigInteger


Folks,
Here's a patch from Mark J. Roberts that I've been long overdue in
checking in.  It fixes a problem with the BigInteger code.
--warrenl


2001-06-19  Mark J. Roberts  <mjr@statesmean.com>

        * java/math/BigInteger.java (byteArrayToIntArray): Don't include
        extraneous/malformed sign word.


Index: java/math/BigInteger.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/math/BigInteger.java,v
retrieving revision 1.11
diff -u -p -r1.11 BigInteger.java
--- BigInteger.java	2001/03/02 06:55:33	1.11
+++ BigInteger.java	2001/06/19 11:37:08
@@ -220,12 +220,8 @@ public class BigInteger extends Number i
   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;




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]