libmoost
moost::math::integer Namespace Reference

Functions

template<typename T >
unsigned log2_compat (T arg)
template<typename T >
unsigned log2 (T arg)

Function Documentation

template<typename T >
unsigned moost::math::integer::log2 ( arg) [inline]

Fast base-2 integer logarithm implementation

There is no run-time check catching the case of passing in zero and the result is undefined if you actually do so.

There is, however, an assertion that checks arg > 0 for debug builds.

Parameters:
argAn unsigned integer argument.
Returns:
The (truncated) base-2 logarithm of arg.

Definition at line 94 of file log2.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
unsigned moost::math::integer::log2_compat ( arg) [inline]

Definition at line 63 of file log2.hpp.

Here is the caller graph for this function: