16 #ifndef IMPALA_UTIL_BIT_STREAM_UTILS_INLINE_H
17 #define IMPALA_UTIL_BIT_STREAM_UTILS_INLINE_H
25 DCHECK_LE(num_bits, 32);
26 DCHECK_EQ(v >> num_bits, 0) <<
"v = " << v <<
", num_bits = " << num_bits;
31 bit_offset_ += num_bits;
41 DCHECK_LT(bit_offset_, 64);
62 byte_offset_ += num_bytes;
69 if (ptr == NULL)
return false;
70 memcpy(ptr, &val, num_bytes);
76 while ((v & 0xFFFFFF80) != 0L) {
77 result &= PutAligned<uint8_t>((v & 0x7F) | 0x80, 1);
80 result &= PutAligned<uint8_t>(v & 0x7F, 1);
87 DCHECK_LE(num_bits, 32);
88 DCHECK_LE(num_bits,
sizeof(T) * 8);
100 if (
LIKELY(bytes_remaining >= 8)) {
116 DCHECK_LE(num_bytes,
sizeof(T));
128 if (
LIKELY(bytes_remaining >= 8)) {
142 if (!GetAligned<uint8_t>(1, &byte))
return false;
143 *v |= (byte & 0x7F) << shift;
146 }
while ((byte & 0x80) != 0);
bool GetAligned(int num_bytes, T *v)
bool PutValue(uint64_t v, int num_bits)
uint64_t buffered_values_
uint64_t buffered_values_
uint8_t * GetNextBytePtr(int num_bytes=1)
bool PutAligned(T v, int num_bytes)
static uint64_t TrailingBits(uint64_t v, int num_bits)
Returns the 'num_bits' least-significant bits of 'v'.
bool GetVlqInt(int32_t *v)
void Flush(bool align=false)
static int Ceil(int value, int divisor)
Returns the ceil of value/divisor.
bool PutVlqInt(int32_t v)
static const int MAX_VLQ_BYTE_LEN
Maximum byte length of a vlq encoded int.
bool GetValue(int num_bits, T *v)