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

Function RoundUpToPowerOf2

cpp/src/arrow/util/bit_util.h:104–106  ·  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

102// The result is undefined on overflow, i.e. if `value > 2**64 - factor`,
103// since we cannot return the correct result which would be 2**64.
104constexpr int64_t RoundUpToPowerOf2(int64_t value, int64_t factor) {
105 return (value + (factor - 1)) & ~(factor - 1);
106}
107
108constexpr uint64_t RoundUpToPowerOf2(uint64_t value, uint64_t factor) {
109 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