|
XenevaOS
|


Go to the source code of this file.
Macros | |
| #define | const_ilog2(n) |
| #define | ilog2(n) |
| #define | roundup_pow_of_two(n) |
| #define | rounddown_pow_of_two(n) |
| #define | order_base_2(n) |
| #define | bits_per(n) |
| #define bits_per | ( | n | ) |
bits_per - calculate the number of bits required for the argument
: parameter
This is constant-capable and can be used for compile time initializations, e.g bitfields.
The first few values calculated by this routine: bf(0) = 1 bf(1) = 1 bf(2) = 2 bf(3) = 2 bf(4) = 3 ... and so on.
| #define const_ilog2 | ( | n | ) |
const_ilog2 - log base 2 of 32-bit or a 64-bit constant unsigned value
: parameter
Use this where sparse expects a true constant expression, e.g. for array indices.
| #define ilog2 | ( | n | ) |
ilog2 - log base 2 of 32-bit or a 64-bit unsigned value
: parameter
constant-capable log of base 2 calculation
selects the appropriately-sized optimised version depending on sizeof(n)
| #define order_base_2 | ( | n | ) |
order_base_2 - calculate the (rounded up) base 2 order of the argument
: parameter
The first few values calculated by this routine: ob2(0) = 0 ob2(1) = 0 ob2(2) = 1 ob2(3) = 2 ob2(4) = 2 ob2(5) = 3 ... and so on.
| #define rounddown_pow_of_two | ( | n | ) |
rounddown_pow_of_two - round the given value down to nearest power of two
: parameter
round the given value down to the nearest power of two
| #define roundup_pow_of_two | ( | n | ) |
roundup_pow_of_two - round the given value up to nearest power of two
: parameter
round the given value up to the nearest power of two