mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Pulled unsigned masks out to BitConstants class
This commit is contained in:
parent
c2ce0a3179
commit
a9d33c2de8
12
core/src/com/riiablo/io/BitConstants.java
Normal file
12
core/src/com/riiablo/io/BitConstants.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.riiablo.io;
|
||||
|
||||
public class BitConstants {
|
||||
private BitConstants() {}
|
||||
|
||||
static final long[] UNSIGNED_MASKS = new long[Long.SIZE];
|
||||
static {
|
||||
for (int i = 1; i < Long.SIZE; i++) {
|
||||
UNSIGNED_MASKS[i] = (UNSIGNED_MASKS[i - 1] << 1) + 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -25,12 +25,7 @@ public class BitInput {
|
||||
|
||||
private static final int MAX_SAFE_CACHED_BITS = Long.SIZE - Byte.SIZE;
|
||||
|
||||
private static final long[] MASKS = new long[Long.SIZE];
|
||||
static {
|
||||
for (int i = 1; i < Long.SIZE; i++) {
|
||||
MASKS[i] = (MASKS[i - 1] << 1) + 1;
|
||||
}
|
||||
}
|
||||
private static final long[] MASKS = BitConstants.UNSIGNED_MASKS;
|
||||
|
||||
private final ByteInput byteInput;
|
||||
private final long numBits;
|
||||
|
Loading…
Reference in New Issue
Block a user