Gromacs
2024.3
|
#include <gromacs/math/functions.h>
Evaluate log2(n) for integer n statically at compile time.
Use as staticLog2<n>::value, where n must be a positive integer. Negative n will be reinterpreted as the corresponding unsigned integer, and you will get a compile-time error if n==0. The calculation is done by recursively dividing n by 2 (until it is 1), and incrementing the result by 1 in each step.
n | Value to recursively calculate log2(n) for |
Static Public Attributes | |
static const int | value |
Variable value used for recursive static calculation of Log2(int) More... | |
|
static |
Variable value used for recursive static calculation of Log2(int)