Skip to content

Commit

Permalink
added set_all function to bitset
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Apr 19, 2024
1 parent 865dd22 commit 4ebf874
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/flatmemory/details/types/bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,22 @@ class Builder<Bitset<Block>> : public IBuilder<Builder<Bitset<Block>>>
unset_all();
}

// Set all bits
void set_all()
{
for (auto& value : m_blocks)
{
value = (m_default_bit_value) ? BitsetOperator::block_zeroes : BitsetOperator::block_ones;
}
}

// Set all bits for a given default_bit_value
void set_all(bool default_bit_value)
{
m_default_bit_value = default_bit_value;
set_all();
}

Builder& operator~()
{
m_default_bit_value = !m_default_bit_value;
Expand Down

0 comments on commit 4ebf874

Please sign in to comment.