MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / nextPowerOfTwo

Function nextPowerOfTwo

src/common/utils.cpp:6–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4namespace common {
5
6uint64_t nextPowerOfTwo(uint64_t v) {
7 v--;
8 v |= v >> 1;
9 v |= v >> 2;
10 v |= v >> 4;
11 v |= v >> 8;
12 v |= v >> 16;
13 v |= v >> 32;
14 v++;
15 return v;
16}
17
18uint64_t prevPowerOfTwo(uint64_t v) {
19 return nextPowerOfTwo((v / 2) + 1);

Callers 5

allocateHashSlotsMethod · 0.85
initializeHashTableMethod · 0.85
prevPowerOfTwoFunction · 0.85
resizeMethod · 0.85
reserveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected