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]
Other format: [Raw text]

[gui] Fix BigIntegers in IndexColorModel


As discussed previously...

2004-10-01 Jerry Quinn <jlquinn@optonline.net>

	* java/awt/image/IndexColorModel.java: Fix use of immutable
	BigIntegers.

--- IndexColorModel.java.~1.6.14.3.~	2004-09-27 22:28:36.000000000 -0400
+++ IndexColorModel.java	2004-09-30 20:56:15.000000000 -0400
@@ -69,7 +69,7 @@
   private boolean opaque;
   private int trans = -1;
   private int[] rgb;
-  private BigInteger validBits = new BigInteger("0");
+  private BigInteger validBits = BigInteger.ZERO;

   /**
    * Each array much contain <code>size</code> elements.  For each
@@ -152,8 +152,7 @@
       }

     // Generate a bigint with 1's for every pixel
-    validBits.setBit(size);
-    validBits.subtract(new BigInteger("1"));
+    validBits = validBits.setBit(size).subtract(BigInteger.ONE);
   }

   /**
@@ -195,8 +194,7 @@
     opaque = !hasAlpha;
     this.trans = trans;
     // Generate a bigint with 1's for every pixel
-    validBits.setBit(size);
-    validBits.subtract(new BigInteger("1"));
+    validBits = validBits.setBit(size).subtract(BigInteger.ONE);
   }

   /**
@@ -229,8 +227,7 @@
     opaque = !hasAlpha;
     this.trans = trans;
     // Generate a bigint with 1's for every pixel
-    validBits.setBit(size);
-    validBits.subtract(new BigInteger("1"));
+    validBits = validBits.setBit(size).subtract(BigInteger.ONE);
   }

/**


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