made getTrueMask in BitSet a lot more rational with fewer code paths.

This commit is contained in:
Mike Keesey 2012-07-06 23:42:54 -06:00
parent 7947981b4b
commit 39ad6da290

View File

@ -34,11 +34,7 @@ public class BitSet implements Serializable, Cloneable {
private static long getTrueMask(int fromIndex, int toIndex) {
int currentRange = toIndex - fromIndex;
if (currentRange == 64) {
return MASK;
} else {
return (((1L << currentRange) - 1L) << (fromIndex % BITS_PER_LONG));
}
return (MASK >>> (BITS_PER_LONG - currentRange)) << (fromIndex % BITS_PER_LONG);
}
public BitSet(int bitLength) {