9 static inline bool extractBit(
unsigned int index,
int word) {
10 return static_cast<bool>((word >> index) & 1);
13 static inline int setBit(
unsigned int index,
int word) {
14 const auto val = 1 << index;
18 static inline int clearBit(
unsigned int index,
int word) {
19 const auto val = 1 << index;
28 bool get(
size_t index)
const {
30 const auto word = data_[wordIdx];
32 return extractBit(static_cast<unsigned int>(relIdx), word);
35 void set(
size_t index) {
37 const auto word = data_[wordIdx];
39 data_[wordIdx] =
setBit(static_cast<unsigned int>(relIdx), word);
44 const auto word = data_[wordIdx];
46 data_[wordIdx] =
clearBit(static_cast<unsigned int>(relIdx), word);
50 for (
size_t i = 0; i < data_word_count_; i++) {
65 const size_t bit_count_;
66 const size_t data_word_count_;
74 bool get(
size_t index)
const {
76 const auto word = data_[wordIdx];
78 return extractBit(static_cast<unsigned int>(relIdx), word);
87 const size_t bit_count_;
88 const size_t data_word_count_;
int * data()
Definition: bit_set.hpp:55
bool get(size_t index) const
Definition: bit_set.hpp:74
Definition: bit_set.hpp:23
const int * data() const
Definition: bit_set.hpp:81
void reset(size_t index)
Definition: bit_set.hpp:42
ProxyBitSet(const int *data, size_t bits)
Definition: bit_set.hpp:71
const int * data() const
Definition: bit_set.hpp:59
static int setBit(unsigned int index, int word)
Definition: bit_set.hpp:13
void reset()
Definition: bit_set.hpp:49
Definition: bit_set.hpp:69
static constexpr size_t BitsInDataWord
Definition: bit_set.hpp:7
static bool extractBit(unsigned int index, int word)
Definition: bit_set.hpp:9
bool get(size_t index) const
Definition: bit_set.hpp:28
MutableProxyBitSet(int *data, size_t bits)
Definition: bit_set.hpp:25
void set(size_t index)
Definition: bit_set.hpp:35
static int clearBit(unsigned int index, int word)
Definition: bit_set.hpp:18