Returns the number of bytes covering a sliced bitmap. Find the length rounded to cover full bytes on both extremities. The following example represents a slice (offset=10, length=9) 0 8 16 24 |-------|-------|------| [ ] (slice) [ ] (same slice aligned to bytes bounds, length=16) The covering bytes is the length (in bytes) of this new aligned slic
| 124 | // |
| 125 | // The covering bytes is the length (in bytes) of this new aligned slice. |
| 126 | constexpr int64_t CoveringBytes(int64_t offset, int64_t length) { |
| 127 | return (bit_util::RoundUp(length + offset, 8) - bit_util::RoundDown(offset, 8)) / 8; |
| 128 | } |
| 129 | |
| 130 | // Returns the 'num_bits' least-significant bits of 'v'. |
| 131 | static inline uint64_t TrailingBits(uint64_t v, int num_bits) { |