Document next_pow2 effects and algorithm source
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
1bbdadadc3
commit
4e56985277
|
@ -112,6 +112,8 @@ uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMer
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return 0 if x == 0, otherwise the smallest power of 2 greater than or equal to x.
|
||||||
|
// Algorithm based on <https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2>.
|
||||||
static uint64_t next_pow2(uint64_t x)
|
static uint64_t next_pow2(uint64_t x)
|
||||||
{
|
{
|
||||||
x -= 1;
|
x -= 1;
|
||||||
|
|
Loading…
Reference in New Issue