16 BitSet Bits, InverseBits;
17 BitSet MaxValue, ValueMask;
20 : Bits(0), InverseBits(0), MaxValue(maxValue), ValueMask(valueMask) {}
22 static void compute2N(
unsigned power, BitSet& value) {
23 value = 1uLL << power;
32 if ((++Bits) <= MaxValue) {
33 InverseBits = (~Bits + 1) & ValueMask;
41 while (0 == (bits & 1uLL) &&
42 ++n <
sizeof(bits) * 8)
44 if (0 != (bits & 1uLL)) bits >>= 1u;
48 bool isSet(
unsigned bit)
const {
return 0 != (
getBitSet() & (1uLL << bit)); }
bool isSet(unsigned bit) const
Composition2N(BitSet maxValue, BitSet valueMask)
unsigned long long BitSet
static void compute2N(unsigned power, BitSet &value)