Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Abc-Arbitrage/Disruptor-cpp
/ ceilingNextPowerOfTwo
Function
ceilingNextPowerOfTwo
Disruptor/Util.cpp:13–23 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
11
{
12
13
std::int32_t ceilingNextPowerOfTwo(std::int32_t x)
14
{
15
std::int32_t result = 2;
16
17
while (result < x)
18
{
19
result <<= 1;
20
}
21
22
return result;
23
}
24
25
bool isPowerOf2(std::int32_t x)
26
{
Callers
2
BOOST_AUTO_TEST_CASE
Function · 0.85
RingBuffer
Method · 0.85
Calls
no outgoing calls
Tested by
1
BOOST_AUTO_TEST_CASE
Function · 0.68