mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Additional assertion to validate invariants
This commit is contained in:
parent
1b51043d7d
commit
97ebbb1dbb
@ -234,6 +234,7 @@ public class BitInput {
|
||||
private long readCacheSafe(int bits) {
|
||||
assert bits > 0 : "bits(" + bits + ") < " + 1;
|
||||
assert bits < Long.SIZE : "bits(" + bits + ") > " + (Long.SIZE - 1);
|
||||
assert bitsCached < bits : "bitsCached(" + bitsCached + ") >= bits(" + bits + ")";
|
||||
final int bitsToAddCount = bits - bitsCached;
|
||||
final int overflowBits = Byte.SIZE - bitsToAddCount;
|
||||
final long nextByte = byteInput._read8u();
|
||||
@ -254,6 +255,7 @@ public class BitInput {
|
||||
private long readCacheUnsafe(int bits) {
|
||||
assert bits > 0 : "bits(" + bits + ") < " + 1;
|
||||
assert bits < Long.SIZE : "bits(" + bits + ") > " + (Long.SIZE - 1);
|
||||
assert bitsCached >= bits : "bitsCached(" + bitsCached + ") < bits(" + bits + ")";
|
||||
final long bitsOut = cache & MASKS[bits];
|
||||
cache >>>= bits;
|
||||
bitsCached -= bits;
|
||||
|
Loading…
Reference in New Issue
Block a user