BitOp¶
High-level bit operation utilities.
Overview¶
Typical use cases:
Calculating the next power of 2 for a given number
Header¶
<RaeptorCogs/BitOp.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Functions¶
Function |
Description |
|---|---|
|
Calculate the next power of 2 greater than or equal to n. |
-
uint64_t RaeptorCogs::NextPowerOf2(uint64_t n)¶
Calculate the next power of 2 greater than or equal to n.
uint64_t result = RaeptorCogs::NextPowerOf2(300); // result = 512
- Parameters:
n – Input number.
- Returns:
The next power of 2 greater than or equal to n.