libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
Count the number of set bits in the input number. More...
#include <count_setbits.hpp>
Public Types | |
typedef unsigned long long | element_type |
Static Public Member Functions | |
static | __attribute__ ((const)) element_type result(element_type num) noexcept(true) |
constexpr static float | efficiency () noexcept(true) |
Count the number of set bits in the input number.
Complexity: run-time: O(1) where n is at most the number of bits used to represent the input type. Space: O(1)
Definition at line 125 of file count_setbits.hpp.
typedef unsigned long long jmmcg::LIBJMMCG_VER_NAMESPACE::dyn::builtin::count_setbits::element_type |
Definition at line 126 of file count_setbits.hpp.
|
inlinestaticnoexcept |
A very simple loop-based implementation, with no lookups nor unrolling.
Definition at line 131 of file count_setbits.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 135 of file count_setbits.hpp.