libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
Create a bitmask of a contiguous block of zeros, then ones, starting at the compile-time constant, input number. More...
#include <bit_fiddling.hpp>
Public Types | |
enum | : element_type { value =MSetBit|(lsb_bitmask<(MSetBit>>1u)>::value) } |
typedef unsigned long long | element_type |
Static Public Attributes | |
constexpr static element_type | number =MSetBit |
Create a bitmask of a contiguous block of zeros, then ones, 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 34 of file bit_fiddling.hpp.
typedef unsigned long long jmmcg::LIBJMMCG_VER_NAMESPACE::mpl::lsb_bitmask< MSetBit >::element_type |
Definition at line 35 of file bit_fiddling.hpp.
anonymous enum : element_type |
Enumerator | |
---|---|
value |
Definition at line 39 of file bit_fiddling.hpp.
|
staticconstexpr |
Definition at line 37 of file bit_fiddling.hpp.