12 constexpr
size_t data_width =
sizeof(std::istream::char_type)*8 - 1;
14 uint8_t which_byte = 0;
16 uint8_t byte = is.get();
17 ret |= (byte & ((1UL<<data_width)-1))<<(data_width * which_byte++);
18 if( !(byte & (1UL<<data_width)))
return ret;
20 DCHECK(
false) <<
"VByte ended without reading a byte with the most significant bit equals zero.";
30 constexpr
size_t data_width =
sizeof(std::ostream::char_type)*8 - 1;
32 uint8_t byte = v & ((1UL<<data_width)-1);
34 if(v > 0) byte |= (1UL<<data_width);
Contains the text compression and encoding framework.
void write_vbyte(std::ostream &os, int_t v)
Store an integer as a bunch of bytes.
int_t read_vbyte(std::istream &is)
Reads an integer stored as a bunch of bytes in the vbyte-encoding.