13#if HX_USE_MACROS_WITH_MODULE
14#error Header does not provide macros alone.
22template<
size_t bit_count_>
69#if HX_CPLUSPLUS < 202002L
72 hxattr_nodiscard hxinline hxconstexpr bool operator!=(const hxbitset& x_) const;
101 void load(
const void* src_,
size_t len_);
129 static_assert(bit_count_ > 0,
"hxbitset requires bit_count > 0");
131 static hxinline_constexpr size_t s_log2_bits_per_word_ = (s_bits_per_word_ > 32u) ? 6u : 5u;
133 static hxinline_constexpr size_t s_words_ = (bit_count_ + s_bit_mask_) >> s_log2_bits_per_word_;
136 ? (
static_cast<size_t>(1u) << s_trailing_bits_) - 1u
137 : ~static_cast<size_t>(0u);
139 size_t m_data_[s_words_];
142#include "detail/hxbitset.inl"
constexpr void operator=(const hxbitset &x_)
Assigns the bits of x to this hxbitset.
static constexpr size_t bytes(void)
Returns the size of the underlying storage in bytes.
Definition hxbitset.hpp:82
constexpr hxbitset & reset(size_t pos_)
Clears the bit at position pos.
constexpr hxbitset & operator^=(const hxbitset &x_)
Applies bitwise XOR with x in place.
constexpr size_t * data(void)
Returns a pointer to the underlying word storage.
Definition hxbitset.hpp:85
constexpr hxbitset & operator<<=(size_t count_)
Shifts all bits left by count positions, filling vacated bits with 0.
constexpr hxbitset(size_t val_)
Constructs a hxbitset from a single size_t value.
constexpr bool none(void) const
Returns true if no bits are set.
Definition hxbitset.hpp:104
constexpr hxbitset & reset(void)
Clears all bits to 0.
constexpr bool test(size_t pos_) const
Returns the value of the bit at position pos.
constexpr bool all(void) const
Returns true if all bits are set.
constexpr hxbitset & set(void)
Sets all bits to 1.
static constexpr size_t size(void)
Returns the number of bits.
Definition hxbitset.hpp:122
constexpr hxbitset & set(size_t pos_, bool value_=true)
Sets or clears the bit at position pos.
constexpr hxbitset & flip(size_t pos_)
Flips the bit at position pos.
constexpr hxbitset(void)
Constructs a zero-initialized hxbitset.
Definition hxbitset.hpp:26
constexpr bool operator[](size_t pos_) const
Returns the value of the bit at position pos.
constexpr bool operator==(const hxbitset &x_) const
Returns true if all bits compare equal to those of x.
constexpr hxbitset & operator>>=(size_t count_)
Shifts all bits right by count positions, filling vacated bits with 0.
void load(const void *src_, size_t len_)
Copies len bytes from src into the hxbitset storage.
constexpr hxbitset & operator&=(const hxbitset &x_)
Applies bitwise AND with x in place.
constexpr hxbitset & operator|=(const hxbitset &x_)
Applies bitwise OR with x in place.
constexpr const size_t * data(void) const
Returns a const pointer to the underlying word storage.
Definition hxbitset.hpp:88
constexpr hxbitset & flip(void)
Flips all bits.
constexpr bool any(void) const
Returns true if at least one bit is set.
constexpr hxbitset(const hxbitset &x_)
Constructs a hxbitset as a copy of x.
#define hxinline
hxinline - Force a function to be inlined into its callers.
Definition hxsettings.h:120
#define hxinline_constexpr
hxinline_constexpr - Enables C++17 compatable "inline constexpr" usage for variables so they can be e...
Definition hxsettings.h:272
#define hxattr_nodiscard
hxattr_nodiscard - Indicates the caller should not discard the return value.
Definition hxsettings.h:89
#define hxconstexpr
hxconstexpr - Enables C++23 compatable constexpr usage for functions as that has support for destruct...
Definition hxsettings.h:263
Provides core macros, memory management and feature detection.