33#include <NDEVR/BaseValues.h>
34#include <NDEVR/LibAssert.h>
82 : m_bits(flag ? 255U : 0U)
85 template<
class t_type>
86 BitFlag(std::initializer_list<t_type> active_list)
89 for (
auto i : active_list)
111 lib_assert(bit_index < 8,
"Tried to access large bit value");
113 return (m_bits & mask) != 0;
170 m_bits |= mask.m_bits;
176 m_bits ^= mask.m_bits;
194 m_bits &= mask.m_bits;
315 return m_bits != other.m_bits;
319 return m_bits == other.m_bits;
343 return value_b ^ ((value_b ^ value_a) & mask);
368 return b ^ ((b ^ a) & mask);
384 struct b4lo {
unsigned __int8 v : 4;
unsigned __int8 _ : 4; };
385 struct b4hi {
unsigned __int8 _ : 4;
unsigned __int8 v : 4; };
386 struct b8 {
unsigned __int8 _; };
387 struct b32 { __int32 _; };
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:70
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:68
constexpr bool operator[](uint01 bit_index) const
Definition BitFlag.hpp:109
constexpr BitFlag(bool flag)
Definition BitFlag.hpp:81
constexpr void operator&=(const BitFlag &mask)
Definition BitFlag.hpp:192
static constexpr BitFlag merge(const BitFlag &value_a, const BitFlag &value_b, const BitFlag &mask)
Definition BitFlag.hpp:341
constexpr BitFlag operator^(const BitFlag &mask) const
Definition BitFlag.hpp:250
constexpr void operator|=(const BitFlag &mask)
Definition BitFlag.hpp:168
constexpr void operator()(const uint01 bit_index, bool value)
Definition BitFlag.hpp:130
constexpr BitFlag(uint01 flags)
Definition BitFlag.hpp:78
constexpr void operator&=(uint01 mask)
Definition BitFlag.hpp:210
BitFlag(std::initializer_list< t_type > active_list)
Definition BitFlag.hpp:86
constexpr BitFlag operator^(uint01 mask) const
Definition BitFlag.hpp:290
constexpr BitFlag operator~() const
Definition BitFlag.hpp:307
constexpr bool operator==(const BitFlag &other) const
Definition BitFlag.hpp:317
constexpr BitFlag()
Definition BitFlag.hpp:70
constexpr bool operator!=(const BitFlag &other) const
Definition BitFlag.hpp:313
constexpr BitFlag operator&(uint01 mask) const
Definition BitFlag.hpp:270
uint01 bits() const
Definition BitFlag.hpp:371
constexpr BitFlag(sint04 flags)
Definition BitFlag.hpp:73
static constexpr BitFlag merge(const BitFlag &a, const BitFlag &b, uint01 num_of_bits)
Definition BitFlag.hpp:365
constexpr void operator^=(const BitFlag &mask)
Definition BitFlag.hpp:174
constexpr BitFlag operator&(const BitFlag &mask) const
Definition BitFlag.hpp:230
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:76
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514