tag/Mask: make everything `constexpr`

This commit is contained in:
Max Kellermann 2023-10-15 11:03:30 +02:00
parent ccbacb369b
commit 70ac638d93
1 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,7 @@ class TagMask {
:value(_value) {}
public:
TagMask() = default;
constexpr TagMask() noexcept = default;
constexpr TagMask(TagType tag) noexcept
:value(mask_t(1) << mask_t(tag)) {}
@ -49,17 +49,17 @@ public:
return TagMask(value ^ other.value);
}
TagMask &operator&=(TagMask other) noexcept {
constexpr TagMask &operator&=(TagMask other) noexcept {
value &= other.value;
return *this;
}
TagMask &operator|=(TagMask other) noexcept {
constexpr TagMask &operator|=(TagMask other) noexcept {
value |= other.value;
return *this;
}
TagMask &operator^=(TagMask other) noexcept {
constexpr TagMask &operator^=(TagMask other) noexcept {
value ^= other.value;
return *this;
}
@ -72,11 +72,11 @@ public:
return (*this & tag).TestAny();
}
void Set(TagType tag) noexcept {
constexpr void Set(TagType tag) noexcept {
*this |= tag;
}
void Unset(TagType tag) noexcept {
constexpr void Unset(TagType tag) noexcept {
*this &= ~TagMask(tag);
}
};