| 27 | #if ARROW_LITTLE_ENDIAN |
| 28 | |
| 29 | BitRunReader::BitRunReader(const uint8_t* bitmap, int64_t start_offset, int64_t length) |
| 30 | : bitmap_(bitmap + (start_offset / 8)), |
| 31 | position_(start_offset % 8), |
| 32 | length_(position_ + length) { |
| 33 | if (ARROW_PREDICT_FALSE(length == 0)) { |
| 34 | word_ = 0; |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | // On the initial load if there is an offset we need to account for this when |
| 39 | // loading bytes. Every other call to LoadWord() should only occur when |
| 40 | // position_ is a multiple of 64. |
| 41 | current_run_bit_set_ = !bit_util::GetBit(bitmap, start_offset); |
| 42 | int64_t bits_remaining = length + position_; |
| 43 | |
| 44 | LoadWord(bits_remaining); |
| 45 | |
| 46 | // Prepare for inversion in NextRun. |
| 47 | // Clear out any preceding bits. |
| 48 | word_ = word_ & ~bit_util::LeastSignificantBitMask<uint64_t>(position_); |
| 49 | } |
| 50 | |
| 51 | #endif |
| 52 | |