4#ifndef EVENTCONTAINERS_IDENTIFIERMASK_H
5#define EVENTCONTAINERS_IDENTIFIERMASK_H
33 void set(
size_t hash) {
41 bool test(
size_t hash)
const {
59 template<
typename Func>
61 for (
size_t block_idx = 0; block_idx <
m_bits.size(); ++block_idx) {
62 uint64_t word =
m_bits[block_idx];
68 int bit_idx = std::countr_zero(word);
89 for (uint64_t word :
m_bits) total += std::popcount(word);
IdentifierMask(size_t maxHash)
static constexpr size_t BitsPerWord
Bits per storage unit (64).
void forEachSetBit(Func &&f) const
Execute a lambda for every set bit The lambda should accept a size_t index.
bool test(size_t hash) const
Check if a hash is present.
void set(size_t hash)
Mark a hash as present.
size_t count() const
Return a count of the bits set to 1.
void clear()
Reset all bits to 0.
std::vector< uint64_t > m_bits
static constexpr size_t MaskShift
Mask shift value for this word size.
void unset(size_t hash)
Remove a hash from the mask (Set bit to 0).
static constexpr size_t Mask
Mask for the bit index (63).
size_t size() const
Return the total size of the mask.