Lines Matching refs:bit_count

21 uint8_t LowestBits(uint8_t byte, size_t bit_count) {  in LowestBits()  argument
22 RTC_DCHECK_LE(bit_count, 8u); in LowestBits()
23 return byte & ((1 << bit_count) - 1); in LowestBits()
28 uint8_t HighestBits(uint8_t byte, size_t bit_count) { in HighestBits() argument
29 RTC_DCHECK_LE(bit_count, 8u); in HighestBits()
30 uint8_t shift = 8 - static_cast<uint8_t>(bit_count); in HighestBits()
64 size_t bit_count = 0; in CountBits() local
66 bit_count++; in CountBits()
69 return bit_count; in CountBits()
110 bool BitBuffer::PeekBits(uint32_t* val, size_t bit_count) { in PeekBits() argument
111 if (!val || bit_count > RemainingBitCount() || bit_count > 32) { in PeekBits()
119 if (bit_count < remaining_bits_in_current_byte) { in PeekBits()
120 *val = HighestBits(bits, bit_offset_ + bit_count); in PeekBits()
125 bit_count -= remaining_bits_in_current_byte; in PeekBits()
126 while (bit_count >= 8) { in PeekBits()
128 bit_count -= 8; in PeekBits()
132 if (bit_count > 0) { in PeekBits()
133 bits <<= bit_count; in PeekBits()
134 bits |= HighestBits(*bytes, bit_count); in PeekBits()
140 bool BitBuffer::ReadBits(uint32_t* val, size_t bit_count) { in ReadBits() argument
141 return PeekBits(val, bit_count) && ConsumeBits(bit_count); in ReadBits()
148 bool BitBuffer::ConsumeBits(size_t bit_count) { in ConsumeBits() argument
149 if (bit_count > RemainingBitCount()) { in ConsumeBits()
153 byte_offset_ += (bit_offset_ + bit_count) / 8; in ConsumeBits()
154 bit_offset_ = (bit_offset_ + bit_count) % 8; in ConsumeBits()
237 bool BitBufferWriter::WriteBits(uint64_t val, size_t bit_count) { in WriteBits() argument
238 if (bit_count > RemainingBitCount()) { in WriteBits()
241 size_t total_bits = bit_count; in WriteBits()
244 val <<= (sizeof(uint64_t) * 8 - bit_count); in WriteBits()
253 std::min(bit_count, remaining_bits_in_current_byte); in WriteBits()
256 if (bit_count <= remaining_bits_in_current_byte) { in WriteBits()
265 bit_count -= bits_in_first_byte; in WriteBits()
266 while (bit_count >= 8) { in WriteBits()
269 bit_count -= 8; in WriteBits()
274 if (bit_count > 0) { in WriteBits()
275 *bytes = WritePartialByte(HighestByte(val), bit_count, *bytes, 0); in WriteBits()