mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Relaxed requirements to allow writing 0 bits (a no-op)
This commit is contained in:
parent
043e032ec5
commit
4a00f0207f
@ -64,16 +64,17 @@ public class BitOutput {
|
||||
}
|
||||
|
||||
void _writeUnsigned(long value, int bits) {
|
||||
assert bits > 0 : "bits(" + bits + ") <= " + 0;
|
||||
assert bits >= 0 : "bits(" + bits + ") < " + 0;
|
||||
assert bits < Long.SIZE : "bits(" + bits + ") > " + (Long.SIZE - 1);
|
||||
assert (value & ~MASKS[bits]) == 0 : "value(" + value + ") is larger than bits(" + bits + ")";
|
||||
_writeRaw(value, bits);
|
||||
}
|
||||
|
||||
void _writeRaw(long value, int bits) {
|
||||
assert bits > 0 : "bits(" + bits + ") < " + 1;
|
||||
assert bits >= 0 : "bits(" + bits + ") < " + 0;
|
||||
assert bits <= Long.SIZE : "bits(" + bits + ") > " + Long.SIZE;
|
||||
assert bitsCached < Byte.SIZE : "bitsCached(" + bitsCached + ") > " + (Byte.SIZE - 1);
|
||||
if (bits == 0) return;
|
||||
incrementBitsWritten(bits);
|
||||
cache |= (value << bitsCached);
|
||||
bitsCached += bits;
|
||||
|
Loading…
Reference in New Issue
Block a user