diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-01 19:59:12 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-01 19:59:12 +0000 |
commit | 51f6f80c492fb2c38dce93568751a830ace50b85 (patch) | |
tree | dd78a28210495cf93b4cbf88f1547c8e3b0c1691 /libjava/java/util/BitSet.java | |
parent | 89d4bc5e939251b80d0d555b57f2700c0b6c20f2 (diff) | |
download | ppe42-gcc-51f6f80c492fb2c38dce93568751a830ace50b85.tar.gz ppe42-gcc-51f6f80c492fb2c38dce93568751a830ace50b85.zip |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51701 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/BitSet.java')
-rw-r--r-- | libjava/java/util/BitSet.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libjava/java/util/BitSet.java b/libjava/java/util/BitSet.java index a85b73721c0..38a9be08994 100644 --- a/libjava/java/util/BitSet.java +++ b/libjava/java/util/BitSet.java @@ -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. |