Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long.Size ? #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -154,7 +154,7 @@ private void compressValue(long value) {
*/
private void writeExistingLeading(long xor) {
out.skipBit();
int significantBits = 64 - storedLeadingZeros - storedTrailingZeros;
int significantBits = Long.SIZE - storedLeadingZeros - storedTrailingZeros;
out.writeBits(xor >>> storedTrailingZeros, significantBits);
}

Expand All @@ -172,7 +172,7 @@ private void writeNewLeading(long xor, int leadingZeros, int trailingZeros) {
out.writeBit();
out.writeBits(leadingZeros, 5); // Number of leading zeros in the next 5 bits

int significantBits = 64 - leadingZeros - trailingZeros;
int significantBits = Long.SIZE - leadingZeros - trailingZeros;
out.writeBits(significantBits, 6); // Length of meaningful bits in the next 6 bits
out.writeBits(xor >>> trailingZeros, significantBits); // Store the meaningful bits of XOR

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Decompressor(BitInput input) {
}

private void readHeader() {
blockTimestamp = in.getLong(64);
blockTimestamp = in.getLong(Long.SIZE);
}

/**
Expand All @@ -49,7 +49,7 @@ private void next() {
endOfStream = true;
return;
}
storedVal = in.getLong(64);
storedVal = in.getLong(Long.SIZE);
storedTimestamp = blockTimestamp + storedDelta;
} else {
nextTimestamp();
Expand Down Expand Up @@ -118,15 +118,15 @@ private void nextValue() {

byte significantBits = (byte) in.getLong(6);
if(significantBits == 0) {
significantBits = 64;
significantBits = Long.SIZE;
}
storedTrailingZeros = 64 - significantBits - storedLeadingZeros;
storedTrailingZeros = Long.SIZE - significantBits - storedLeadingZeros;
}
long value = in.getLong(64 - storedLeadingZeros - storedTrailingZeros);
long value = in.getLong(Long.SIZE - storedLeadingZeros - storedTrailingZeros);
value <<= storedTrailingZeros;
value = storedVal ^ value;
storedVal = value;
}
}

}
}