MCPcopy Create free account
hub / github.com/apache/arrow / TrailingBits

Function TrailingBits

cpp/src/arrow/util/bit_util.h:134–139  ·  view source on GitHub ↗

Returns the 'num_bits' least-significant bits of 'v'.

Source from the content-addressed store, hash-verified

132
133// Returns the 'num_bits' least-significant bits of 'v'.
134static 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)).
142static inline int Log2(uint64_t x) {

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68