33#include <NDEVR/BaseValues.h>
34#include <NDEVR/LibAssert.h>
69 : m_bits(flag ? 255U : 0U)
72 template<
class t_type>
73 BitFlag(std::initializer_list<t_type> active_list)
76 for (
auto i : active_list)
88 lib_assert(bit_index < 8,
"Tried to access large bit value");
90 return (m_bits & mask) != 0;
123 m_bits |= mask.m_bits;
129 m_bits ^= mask.m_bits;
138 m_bits &= mask.m_bits;
202 return m_bits != other.m_bits;
206 return m_bits == other.m_bits;
220 return value_b ^ ((value_b ^ value_a) & mask);
234 return value_b ^ ((value_b ^ value_a) & mask);
250 struct b4lo {
unsigned __int8 v : 4;
unsigned __int8 _ : 4; };
251 struct b4hi {
unsigned __int8 _ : 4;
unsigned __int8 v : 4; };
252 struct b8 {
unsigned __int8 _; };
253 struct b32 { __int32 _; };
#define lib_assert(expression, message)
Definition LibAssert.h:61
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:55
constexpr bool operator[](uint01 bit_index) const
Accesses the value at bit position specified by index. Note this function may have more overhead than...
Definition BitFlag.hpp:86
constexpr BitFlag(bool flag)
Definition BitFlag.hpp:68
constexpr void operator&=(const BitFlag &mask)
Bitwise 'and' assignment operator.
Definition BitFlag.hpp:136
static constexpr BitFlag merge(const BitFlag &value_a, const BitFlag &value_b, const BitFlag &mask)
Given bit value_a and bit value_b merges the bits such that indices with a mask of false will be set ...
Definition BitFlag.hpp:218
constexpr BitFlag operator^(const BitFlag &mask) const
Bitwise 'exclusive or' operator.
Definition BitFlag.hpp:165
constexpr void operator|=(const BitFlag &mask)
Bitwise 'or' assignment operator.
Definition BitFlag.hpp:121
static constexpr BitFlag merge(const BitFlag &value_a, const BitFlag &value_b, uint01 num_of_bits)
Given bit value_a and bit value_b merges the bits such that indices with a value lower than num_of_bi...
Definition BitFlag.hpp:231
constexpr void operator()(const uint01 bit_index, bool value)
Operator used to set a bit in the bitflag to the given value Parameters:
Definition BitFlag.hpp:99
constexpr BitFlag(uint01 flags)
Definition BitFlag.hpp:65
constexpr void operator&=(uint01 mask)
Bitwise 'and' assignment operator.
Definition BitFlag.hpp:145
BitFlag(std::initializer_list< t_type > active_list)
Definition BitFlag.hpp:73
constexpr BitFlag operator^(uint01 mask) const
Bitwise 'exclusive or' operator.
Definition BitFlag.hpp:185
constexpr BitFlag operator~() const
Bitwise 'ones complement' operator.
Definition BitFlag.hpp:194
constexpr bool operator==(const BitFlag &other) const
Definition BitFlag.hpp:204
constexpr BitFlag()
Definition BitFlag.hpp:57
constexpr bool operator!=(const BitFlag &other) const
Definition BitFlag.hpp:200
constexpr BitFlag operator&(uint01 mask) const
Bitwise 'and' operator.
Definition BitFlag.hpp:175
uint01 bits() const
Definition BitFlag.hpp:237
constexpr BitFlag(sint04 flags)
Definition BitFlag.hpp:60
constexpr void operator^=(const BitFlag &mask)
Definition BitFlag.hpp:127
constexpr BitFlag operator&(const BitFlag &mask) const
Bitwise 'and' operator.
Definition BitFlag.hpp:155
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:64
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
Definition BitFlag.hpp:249