in java/src/main/java/com/epam/deltix/zstd/BitStream.java [153:181]
public boolean load() {
if (bitsConsumed > 64) {
overflow = true;
return true;
} else if (currentAddress == startAddress) {
return true;
}
int bytes = bitsConsumed >>> 3; // divide by 8
if (currentAddress >= startAddress + SIZE_OF_LONG) {
if (bytes > 0) {
currentAddress -= bytes;
bits = inputBase.getLong(currentAddress);
}
bitsConsumed &= 0b111;
} else if (currentAddress - bytes < startAddress) {
bytes = (int) (currentAddress - startAddress);
currentAddress = startAddress;
bitsConsumed -= bytes * SIZE_OF_LONG;
bits = inputBase.getLong(startAddress);
return true;
} else {
currentAddress -= bytes;
bitsConsumed -= bytes * SIZE_OF_LONG;
bits = inputBase.getLong(currentAddress);
}
return false;
}