17 using size_type =
typename TBitset::size_type;
20 const TBitset* m_bitset =
nullptr;
25 return ~m_bitset->data(
wordIdx);
30 GAIA_NODISCARD
bool check_bit(
uint32_t pos)
const noexcept {
32 return !m_bitset->test(pos);
34 return m_bitset->test(pos);
39 const auto item_count = m_bitset->items();
43 const size_type
posInWord = pos % TBitset::BitsPerItem + 1;
44 if GAIA_LIKELY (
posInWord < TBitset::BitsPerItem) {
45 const size_type mask = (size_type(1) <<
posInWord) - 1;
49 GAIA_MSVC_WARNING_PUSH()
50 GAIA_MSVC_WARNING_DISABLE(4244)
53 if constexpr (TBitset::BitsPerItem == 32)
56 return wordIndex * TBitset::BitsPerItem + GAIA_FFS64(
word) - 1;
65 GAIA_MSVC_WARNING_POP()
72 const size_type
posInWord = pos % TBitset::BitsPerItem;
73 const size_type mask = (size_type(1) <<
posInWord) - 1;
76 GAIA_MSVC_WARNING_PUSH()
77 GAIA_MSVC_WARNING_DISABLE(4244)
80 if constexpr (TBitset::BitsPerItem == 32)
81 return TBitset::BitsPerItem * (
wordIndex + 1) - GAIA_CTZ(
word) - 1;
83 return TBitset::BitsPerItem * (
wordIndex + 1) - GAIA_CTZ64(
word) - 1;
92 GAIA_MSVC_WARNING_POP()
99 if constexpr (!
IsFwd) {
101 if (pos != 0 || !check_bit(0)) {
102 pos = find_next_set_bit(m_pos);
112 if (pos != 0 || !check_bit(0)) {
113 pos = find_next_set_bit(m_pos);
128 if constexpr (!
IsFwd) {
130 if (pos !=
lastBit || !check_bit(pos)) {
131 const auto newPos = find_prev_set_bit(pos);
137 if (pos !=
lastBit || !check_bit(pos)) {
138 const auto newPos = find_prev_set_bit(pos);
155 GAIA_NODISCARD
value_type operator->()
const {
164 if constexpr (!
IsFwd) {
168 auto newPos = find_prev_set_bit(m_pos);
174 auto newPos = find_next_set_bit(m_pos);
191 return m_pos == other.m_pos;
195 return m_pos != other.m_pos;