13#if HX_USE_MACROS_WITH_MODULE
14#error Header does not provide macros alone.
25template<
size_t bit_count_>
47 template<
typename int_t_>
82#if HX_CPLUSPLUS < 202002L
85 hxattr_nodiscard hxinline hxconstexpr bool operator!=(const hxbitset& x_) const;
135 static_assert(bit_count_ > 0,
"hxbitset requires bit_count > 0");
137 static hxinline_constexpr size_t s_log2_bits_per_word_ = (s_bits_per_word_ > 32u) ? 6u : 5u;
139 static hxinline_constexpr size_t s_words_ = (bit_count_ + s_bit_mask_) >> s_log2_bits_per_word_;
142 ? (
static_cast<size_t>(1u) << s_trailing_bits_) - 1u
143 : ~static_cast<size_t>(0u);
145 size_t m_data_[s_words_];
148#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:95
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)
Definition hxbitset.hpp:100
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:110
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:128
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(std::initializer_list< int_t_ > x_)
Constructs a hxbitset from a list of integers, packed low element first within each size_t word and l...
constexpr hxbitset(void)
Constructs a zero-initialized hxbitset.
Definition hxbitset.hpp:29
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.
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:98
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.
Implements or includes std::initializer_list depending on HX_USE_LIBCXX.
#define hxinline
hxinline - Force a function to be inlined into its callers.
Definition hxsettings.h:125
#define hxinline_constexpr
hxinline_constexpr - Enables C++17 compatable "inline constexpr" usage for variables so they can be e...
Definition hxsettings.h:275
#define hxattr_nodiscard
hxattr_nodiscard - Indicates the caller should not discard the return value.
Definition hxsettings.h:98
#define hxconstexpr
hxconstexpr - Enables C++23 compatable constexpr usage for functions as that has support for destruct...
Definition hxsettings.h:266
Provides core macros, memory management and feature detection.