BitSet.java (BitSet(int)): if nbits < 0 throw NegativeArraySizeException
authorMark Wielaard <mark@klomp.org>
Mon, 1 Apr 2002 19:59:12 +0000 (19:59 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Mon, 1 Apr 2002 19:59:12 +0000 (19:59 +0000)
        * java/util/BitSet.java (BitSet(int)): if nbits < 0 throw
        NegativeArraySizeException
        (clear(int)): Use sign extended shift.
        (flip(int)): Likewise.
        (get(int)): Likewise.
        (nextClearBit(int)): Likewise.
        (nextSetBit(int)): Likewise.
        (set(int)): Likewise.

From-SVN: r51701

libjava/ChangeLog
libjava/java/util/BitSet.java

index e5333f6c5218e988b12f904ba87ea44b13c7cc78..4fe72e6e7ea934ba8ef31d323b13b2919ccab54b 100644 (file)
@@ -1,3 +1,14 @@
+2002-04-01  Mark Wielaard  <mark@klomp.org>
+
+        * java/util/BitSet.java (BitSet(int)): if nbits < 0 throw
+        NegativeArraySizeException
+        (clear(int)): Use sign extended shift.
+        (flip(int)): Likewise.
+        (get(int)): Likewise.
+        (nextClearBit(int)): Likewise.
+        (nextSetBit(int)): Likewise.
+        (set(int)): Likewise.
+
 2002-04-01  Mark Wielaard  <mark@klomp.org>
 
        * mauve-libgcj: Add JDK1.3, JDK1.4, JLS1.2 tests, remove ignored tests
index a85b73721c07ed430a3f8999234b414eb970651a..38a9be08994fbb5a5a25373857e57497c1b78eb8 100644 (file)
@@ -102,6 +102,9 @@ public class BitSet implements Cloneable, Serializable
    */
   public BitSet(int nbits)
   {
+    if (nbits < 0)
+      throw new NegativeArraySizeException();
+    
     int length = nbits >>> 6;
     if ((nbits & LONG_MASK) != 0)
       ++length;
@@ -195,7 +198,7 @@ public class BitSet implements Cloneable, Serializable
    */
   public void clear(int pos)
   {
-    int offset = pos >>> 6;
+    int offset = pos >> 6;
     ensure(offset);
     // ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException,
     // so we'll just let that be our exception.
@@ -289,7 +292,7 @@ public class BitSet implements Cloneable, Serializable
    */
   public void flip(int index)
   {
-    int offset = index >>> 6;
+    int offset = index >> 6;
     ensure(offset);
     // ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException,
     // so we'll just let that be our exception.
@@ -335,7 +338,7 @@ public class BitSet implements Cloneable, Serializable
    */
   public boolean get(int pos)
   {
-    int offset = pos >>> 6;
+    int offset = pos >> 6;
     if (offset >= bits.length)
       return false;
     // ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException,
@@ -498,7 +501,7 @@ public class BitSet implements Cloneable, Serializable
    */
   public int nextClearBit(int from)
   {
-    int offset = from >>> 6;
+    int offset = from >> 6;
     long mask = 1L << from;
     while (offset < bits.length)
       {
@@ -535,7 +538,7 @@ public class BitSet implements Cloneable, Serializable
    */
   public int nextSetBit(int from)
   {
-    int offset = from >>> 6;
+    int offset = from >> 6;
     long mask = 1L << from;
     while (offset < bits.length)
       {
@@ -583,7 +586,7 @@ public class BitSet implements Cloneable, Serializable
    */
   public void set(int pos)
   {
-    int offset = pos >>> 6;
+    int offset = pos >> 6;
     ensure(offset);
     // ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException,
     // so we'll just let that be our exception.