libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
Compute the bit position of the set bit, starting at the compile-time constant, input number. More...
#include <bit_fiddling.hpp>
Public Types | |
enum | : element_type { value =bit_position<(SetBit>>1u)>::value+1 } |
typedef unsigned long long | element_type |
Static Public Attributes | |
constexpr static element_type | number =SetBit |
Compute the bit position of the set bit, starting at the compile-time constant, input number.
Because the operator>>() is poorly defined this only works for unsigned types. This is because there may be a sign bit or two's complement representation of the negative number. Then shifting might cause the sign bit to be shifted into the number itself, possibly causing an infinite loop.
Complexity: compile-time: O(n) where n is at most the number of bits used to represent the input type. run-time: O(1) Space: O(1)
Definition at line 68 of file bit_fiddling.hpp.
typedef unsigned long long jmmcg::LIBJMMCG_VER_NAMESPACE::mpl::bit_position< SetBit >::element_type |
Definition at line 69 of file bit_fiddling.hpp.
anonymous enum : element_type |
Enumerator | |
---|---|
value |
Definition at line 73 of file bit_fiddling.hpp.
|
staticconstexpr |
Definition at line 71 of file bit_fiddling.hpp.