Return the number of bytes needed to fit the given number of bits
| 50 | |
| 51 | // Return the number of bytes needed to fit the given number of bits |
| 52 | constexpr int64_t BytesForBits(int64_t bits) { |
| 53 | // This formula avoids integer overflow on very large `bits` |
| 54 | return (bits >> 3) + ((bits & 7) != 0); |
| 55 | } |
| 56 | |
| 57 | // Returns the smallest power of two that contains v. If v is already a |
| 58 | // power of two, it is returned as is. |
no outgoing calls