mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-21 01:00:54 +08:00
classlib: fix issue in BitSet.set
This commit is contained in:
parent
7cd121ec97
commit
9f349385ec
@ -169,6 +169,9 @@ public class TBitSet extends TObject implements TCloneable, TSerializable {
|
||||
if (fromIndex > toIndex) {
|
||||
throw new TIndexOutOfBoundsException();
|
||||
}
|
||||
if (fromIndex == toIndex) {
|
||||
return;
|
||||
}
|
||||
int fromDataIndex = fromIndex / 32;
|
||||
int toDataIndex = toIndex / 32;
|
||||
if (toIndex > length) {
|
||||
@ -224,6 +227,9 @@ public class TBitSet extends TObject implements TCloneable, TSerializable {
|
||||
return;
|
||||
}
|
||||
toIndex = TMath.min(length, toIndex);
|
||||
if (fromIndex == toIndex) {
|
||||
return;
|
||||
}
|
||||
int fromDataIndex = fromIndex / 32;
|
||||
int toDataIndex = toIndex / 32;
|
||||
if (fromDataIndex == toDataIndex) {
|
||||
|
@ -878,6 +878,9 @@ public class BitSetTest {
|
||||
|
||||
bs.set(2, 2);
|
||||
assertFalse("Bit got set incorrectly ", bs.get(2));
|
||||
|
||||
bs = new BitSet();
|
||||
bs.set(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user