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
| 127 | // |
| 128 | // The covering bytes is the length (in bytes) of this new aligned slice. |
| 129 | constexpr int64_t CoveringBytes(int64_t offset, int64_t length) { |
| 130 | return (bit_util::RoundUp(length + offset, 8) - bit_util::RoundDown(offset, 8)) / 8; |
| 131 | } |
| 132 | |
| 133 | // Returns the 'num_bits' least-significant bits of 'v'. |
| 134 | static inline uint64_t TrailingBits(uint64_t v, int num_bits) { |