Warning: session_start(): open(/var/lib/php/sessions/sess_fg38bftmfhumblchje2v9fhujn, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass BitHead > ByteHead {
gettable int align;
gettable int currentByte;
*() {}
*(InputStream inputStream) { super(inputStream); }
*(OutputStream outputStream) { super(outputStream); }
// slow version of write byte[] looping manually
void write(byte[] data) {
for (b : data) write(b);
}
void writeByte(int i) {
if (align == 0)
super.writeByte(i);
else {
currentByte |= i << align;
super.writeByte(currentByte);
currentByte = i >> (8-align);
}
}
void writeBit(bool b) {
if (b) currentByte |= 1 << align;
if (align == 7) {
super.writeByte(currentByte);
currentByte = align = 0;
} else
++align;
}
bool byteAligned() {
ret align == 0;
}
void completeByte aka flushBits aka finish(bool padWithOnes default false) {
if (byteAligned()) ret;
if (padWithOnes) currentByte |= 0xFF << align;
super.writeByte(currentByte);
currentByte = align = 0;
}
void writeTrailingBitCount(bool padWithOnes default false) {
int bitCount = modRange_incl(align(), 1, 8);
completeByte(padWithOnes);
writeByte(bitCount);
}
}