|
Gromacs
2018.6
|
#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 = StaticLog2<n/2>::value+1 |
| Variable value used for recursive static calculation of Log2(int) | |
1.8.5