Lines Matching refs:bit_offset
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
70 DCHECK_LE(bit_offset, bit_size_); in Subregion()
71 DCHECK_LE(bit_length, bit_size_ - bit_offset); in Subregion()
73 result.bit_start_ += bit_offset; in Subregion()
78 ALWAYS_INLINE BitMemoryRegion Subregion(size_t bit_offset) const { in Subregion() argument
79 DCHECK_LE(bit_offset, bit_size_); in Subregion()
81 result.bit_start_ += bit_offset; in Subregion()
82 result.bit_size_ -= bit_offset; in Subregion()
88 ALWAYS_INLINE bool LoadBit(size_t bit_offset) const { in LoadBit() argument
89 DCHECK_LT(bit_offset, bit_size_); in LoadBit()
90 size_t index = (bit_start_ + bit_offset) / kBitsPerByte; in LoadBit()
91 size_t shift = (bit_start_ + bit_offset) % kBitsPerByte; in LoadBit()
95 ALWAYS_INLINE void StoreBit(size_t bit_offset, bool value) { in StoreBit() argument
96 DCHECK_LT(bit_offset, bit_size_); in StoreBit()
97 size_t index = (bit_start_ + bit_offset) / kBitsPerByte; in StoreBit()
98 size_t shift = (bit_start_ + bit_offset) % kBitsPerByte; in StoreBit()
101 DCHECK_EQ(value, LoadBit(bit_offset)); in StoreBit()
109 ALWAYS_INLINE Result LoadBits(size_t bit_offset, size_t bit_length) const { in LoadBits() argument
113 DCHECK_LE(bit_offset, bit_size_); in LoadBits()
114 DCHECK_LE(bit_length, bit_size_ - bit_offset); in LoadBits()
122 size_t index = (bit_start_ + bit_offset) / width; in LoadBits()
123 size_t shift = (bit_start_ + bit_offset) % width; in LoadBits()
139 ALWAYS_INLINE void StoreBits(size_t bit_offset, uint32_t value, size_t bit_length) { in StoreBits() argument
140 DCHECK_LE(bit_offset, bit_size_); in StoreBits()
141 DCHECK_LE(bit_length, bit_size_ - bit_offset); in StoreBits()
150 size_t index = (bit_start_ + bit_offset) / kBitsPerByte; in StoreBits()
151 size_t shift = (bit_start_ + bit_offset) % kBitsPerByte; in StoreBits()
159 DCHECK_EQ(value, LoadBits(bit_offset, bit_length)); in StoreBits()
163 ALWAYS_INLINE void StoreBits(size_t bit_offset, const BitMemoryRegion& src, size_t bit_length) { in StoreBits() argument
164 DCHECK_LE(bit_offset, bit_size_); in StoreBits()
165 DCHECK_LE(bit_length, bit_size_ - bit_offset); in StoreBits()
169 StoreBits(bit_offset + bit, src.LoadBits(bit, kNumBits), kNumBits); in StoreBits()
172 StoreBits(bit_offset + bit, src.LoadBits(bit, num_bits), num_bits); in StoreBits()
176 ALWAYS_INLINE void OrBits(size_t bit_offset, const BitMemoryRegion& src, size_t bit_length) { in OrBits() argument
180 DCHECK_LE(bit_offset, bit_size_); in OrBits()
181 DCHECK_LE(bit_length, bit_size_ - bit_offset); in OrBits()
185 size_t old_bits = LoadBits(bit_offset + bit, kNumBits); in OrBits()
186 StoreBits(bit_offset + bit, old_bits | src.LoadBits(bit, kNumBits), kNumBits); in OrBits()
189 size_t old_bits = LoadBits(bit_offset + bit, num_bits); in OrBits()
190 StoreBits(bit_offset + bit, old_bits | src.LoadBits(bit, num_bits), num_bits); in OrBits()
194 ALWAYS_INLINE size_t PopCount(size_t bit_offset, size_t bit_length) const { in PopCount() argument
195 DCHECK_LE(bit_offset, bit_size_); in PopCount()
196 DCHECK_LE(bit_length, bit_size_ - bit_offset); in PopCount()
201 count += POPCOUNT(LoadBits(bit_offset + bit, kNumBits)); in PopCount()
203 count += POPCOUNT(LoadBits(bit_offset + bit, bit_length - bit)); in PopCount()
208 ALWAYS_INLINE bool HasSomeBitSet(size_t bit_offset, size_t bit_length) const { in HasSomeBitSet() argument
212 DCHECK_LE(bit_offset, bit_size_); in HasSomeBitSet()
213 DCHECK_LE(bit_length, bit_size_ - bit_offset); in HasSomeBitSet()
217 if (LoadBits(bit_offset + bit, kNumBits) != 0u) { in HasSomeBitSet()
221 return LoadBits(bit_offset + bit, bit_length - bit) != 0u; in HasSomeBitSet()
261 explicit BitMemoryReader(const uint8_t* data, ssize_t bit_offset = 0)
262 : finished_region_(const_cast<uint8_t*>(data), bit_offset, /* bit_length */ 0) {
272 size_t bit_offset = finished_region_.size_in_bits(); in ReadRegion() local
273 finished_region_.Resize(bit_offset + bit_length); in ReadRegion()
274 return finished_region_.Subregion(bit_offset, bit_length); in ReadRegion()
327 explicit BitMemoryWriter(Vector* out, size_t bit_offset = 0)
328 : out_(out), bit_start_(bit_offset), bit_offset_(bit_offset) {