mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -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