Gromacs  2026.0-dev-20241213-9ac17bb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Static Public Attributes
gmx::StaticLog2< n > Struct Template Reference

#include <gromacs/math/functions.h>

Description

template<std::uint64_t n>
struct gmx::StaticLog2< n >

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.

Template Parameters
nValue to recursively calculate log2(n) for

Static Public Attributes

static const int value
 Variable value used for recursive static calculation of Log2(int) More...
 

Member Data Documentation

template<std::uint64_t n>
const int gmx::StaticLog2< n >::value
static
Initial value:
= StaticLog2<n / 2>::value
+ 1

Variable value used for recursive static calculation of Log2(int)


The documentation for this struct was generated from the following file: