Returns the 'num_bits' least-significant bits of 'v'.
| 132 | |
| 133 | // Returns the 'num_bits' least-significant bits of 'v'. |
| 134 | static inline uint64_t TrailingBits(uint64_t v, int num_bits) { |
| 135 | if (ARROW_PREDICT_FALSE(num_bits == 0)) return 0; |
| 136 | if (ARROW_PREDICT_FALSE(num_bits >= 64)) return v; |
| 137 | int n = 64 - num_bits; |
| 138 | return (v << n) >> n; |
| 139 | } |
| 140 | |
| 141 | // Returns ceil(log2(x)). |
| 142 | static inline int Log2(uint64_t x) { |