| 303 | } |
| 304 | |
| 305 | uint64_t LoadPartialWord(int8_t bit_offset, int64_t num_bits) { |
| 306 | assert(num_bits > 0); |
| 307 | uint64_t word = 0; |
| 308 | const int64_t num_bytes = bit_util::BytesForBits(num_bits); |
| 309 | if (Reverse) { |
| 310 | // Read in the most significant bytes of the word |
| 311 | bitmap_ -= num_bytes; |
| 312 | memcpy(reinterpret_cast<char*>(&word) + 8 - num_bytes, bitmap_, num_bytes); |
| 313 | // XXX MostSignificantBitmask |
| 314 | return (bit_util::ToLittleEndian(word) << bit_offset) & |
| 315 | ~bit_util::LeastSignificantBitMask<uint64_t>(64 - num_bits); |
| 316 | } else { |
| 317 | memcpy(&word, bitmap_, num_bytes); |
| 318 | bitmap_ += num_bytes; |
| 319 | return (bit_util::ToLittleEndian(word) >> bit_offset) & |
| 320 | bit_util::LeastSignificantBitMask<uint64_t>(num_bits); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | void SkipNextZeros() { |
| 325 | assert(current_num_bits_ == 0); |
no test coverage detected