mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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) {
|
if (fromIndex > toIndex) {
|
||||||
throw new TIndexOutOfBoundsException();
|
throw new TIndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
if (fromIndex == toIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int fromDataIndex = fromIndex / 32;
|
int fromDataIndex = fromIndex / 32;
|
||||||
int toDataIndex = toIndex / 32;
|
int toDataIndex = toIndex / 32;
|
||||||
if (toIndex > length) {
|
if (toIndex > length) {
|
||||||
|
@ -224,6 +227,9 @@ public class TBitSet extends TObject implements TCloneable, TSerializable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toIndex = TMath.min(length, toIndex);
|
toIndex = TMath.min(length, toIndex);
|
||||||
|
if (fromIndex == toIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int fromDataIndex = fromIndex / 32;
|
int fromDataIndex = fromIndex / 32;
|
||||||
int toDataIndex = toIndex / 32;
|
int toDataIndex = toIndex / 32;
|
||||||
if (fromDataIndex == toDataIndex) {
|
if (fromDataIndex == toDataIndex) {
|
||||||
|
|
|
@ -878,6 +878,9 @@ public class BitSetTest {
|
||||||
|
|
||||||
bs.set(2, 2);
|
bs.set(2, 2);
|
||||||
assertFalse("Bit got set incorrectly ", bs.get(2));
|
assertFalse("Bit got set incorrectly ", bs.get(2));
|
||||||
|
|
||||||
|
bs = new BitSet();
|
||||||
|
bs.set(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue
Block a user