Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public class SparseFixedBitSet extends BitSet {
private static final long SINGLE_ELEMENT_ARRAY_BYTES_USED = RamUsageEstimator.sizeOf(new long[1]);
private static final int MASK_4096 = (1 << 12) - 1;

private static int blockCount(int length) {
static int blockCount(int length) {
int blockCount = length >>> 12;
if ((blockCount << 12) < length) {
++blockCount;
}
assert (blockCount << 12) >= length;
assert ((long) blockCount << 12) >= length;
return blockCount;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,8 @@ public void testNextClearBit() {
}
}
}

public void testLargeValuesDoNotOverflow() {
assertEquals(524288, SparseFixedBitSet.blockCount(2147479553));
}
}
Loading