Lines Matching refs:bit_length
49 ALWAYS_INLINE BitMemoryRegion(MemoryRegion region, size_t bit_offset, size_t bit_length) in BitMemoryRegion() argument
51 *this = Subregion(bit_offset, bit_length); in BitMemoryRegion()
69 ALWAYS_INLINE BitMemoryRegion Subregion(size_t bit_offset, size_t bit_length) const { in Subregion() argument
71 DCHECK_LE(bit_length, bit_size_ - bit_offset); in Subregion()
74 result.bit_size_ = bit_length; in Subregion()
109 ALWAYS_INLINE uint32_t LoadBits(size_t bit_offset, size_t bit_length) const { in LoadBits() argument
112 DCHECK_LE(bit_length, bit_size_ - bit_offset); in LoadBits()
113 DCHECK_LE(bit_length, BitSizeOf<uint32_t>()); in LoadBits()
114 if (bit_length == 0) { in LoadBits()
117 uintptr_t mask = std::numeric_limits<uintptr_t>::max() >> (kBitsPerIntPtrT - bit_length); in LoadBits()
122 if (finished_bits < bit_length) { in LoadBits()
130 ALWAYS_INLINE void StoreBits(size_t bit_offset, uint32_t value, size_t bit_length) { in StoreBits() argument
132 DCHECK_LE(bit_length, bit_size_ - bit_offset); in StoreBits()
133 DCHECK_LE(bit_length, BitSizeOf<uint32_t>()); in StoreBits()
134 DCHECK_LE(value, MaxInt<uint32_t>(bit_length)); in StoreBits()
135 if (bit_length == 0) { in StoreBits()
141 uint32_t mask = std::numeric_limits<uint32_t>::max() >> (BitSizeOf<uint32_t>() - bit_length); in StoreBits()
147 for (int i = 1; finished_bits < bit_length; i++, finished_bits += kBitsPerByte) { in StoreBits()
151 DCHECK_EQ(value, LoadBits(bit_offset, bit_length)); in StoreBits()
155 ALWAYS_INLINE void StoreBits(size_t bit_offset, const BitMemoryRegion& src, size_t bit_length) { in StoreBits() argument
157 DCHECK_LE(bit_length, bit_size_ - bit_offset); in StoreBits()
160 for (; bit + kNumBits <= bit_length; bit += kNumBits) { in StoreBits()
163 size_t num_bits = bit_length - bit; in StoreBits()
168 ALWAYS_INLINE size_t PopCount(size_t bit_offset, size_t bit_length) const { in PopCount() argument
170 DCHECK_LE(bit_length, bit_size_ - bit_offset); in PopCount()
174 for (; bit + kNumBits <= bit_length; bit += kNumBits) { in PopCount()
177 count += POPCOUNT(LoadBits(bit_offset + bit, bit_length - bit)); in PopCount()
229 ALWAYS_INLINE BitMemoryRegion ReadRegion(size_t bit_length) { in ReadRegion() argument
231 finished_region_.Resize(bit_offset + bit_length); in ReadRegion()
232 return finished_region_.Subregion(bit_offset, bit_length); in ReadRegion()
235 ALWAYS_INLINE uint32_t ReadBits(size_t bit_length) { in ReadBits() argument
236 return ReadRegion(bit_length).LoadBits(/* bit_offset */ 0, bit_length); in ReadBits()
279 ALWAYS_INLINE BitMemoryRegion Allocate(size_t bit_length) { in Allocate() argument
280 out_->resize(BitsToBytesRoundUp(bit_offset_ + bit_length)); in Allocate()
281 BitMemoryRegion region(out_->data(), bit_offset_, bit_length); in Allocate()
282 DCHECK_LE(bit_length, std::numeric_limits<size_t>::max() - bit_offset_) << "Overflow"; in Allocate()
283 bit_offset_ += bit_length; in Allocate()
291 ALWAYS_INLINE void WriteBits(uint32_t value, size_t bit_length) { in WriteBits() argument
292 Allocate(bit_length).StoreBits(/* bit_offset */ 0, value, bit_length); in WriteBits()