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

Function RoundUpToPowerOf2

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

Returns 'value' rounded up to the nearest multiple of 'factor' when factor is a power of two. The result is undefined on overflow, i.e. if `value > 2**64 - factor`, since we cannot return the correct result which would be 2**64.

Source from the content-addressed store, hash-verified

99// The result is undefined on overflow, i.e. if `value > 2**64 - factor`,
100// since we cannot return the correct result which would be 2**64.
101constexpr int64_t RoundUpToPowerOf2(int64_t value, int64_t factor) {
102 return (value + (factor - 1)) & ~(factor - 1);
103}
104
105constexpr uint64_t RoundUpToPowerOf2(uint64_t value, uint64_t factor) {
106 return (value + (factor - 1)) & ~(factor - 1);

Callers 7

BitmapWordAlignFunction · 0.85
RoundUpToMultipleOf8Function · 0.85
RoundUpToMultipleOf64Function · 0.85
bitmap.hFile · 0.85
TESTFunction · 0.85
gdv_fn_aes_encryptFunction · 0.85
gdv_fn_aes_decryptFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68