diff options
author | Max Kellermann <max@musicpd.org> | 2019-11-05 10:56:20 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-11-05 10:56:20 +0100 |
commit | 43ac264f5497ac9b0f1135e4cacd31a5a8b6aa1f (patch) | |
tree | 3c4a07d198907b2bc349813ee91cfab65a265b4e /src/tag | |
parent | cbaa98c1a19319bcdd9cde146320de8b4b5ac4af (diff) |
tag/Mask: add `noexcept`
Diffstat (limited to 'src/tag')
-rw-r--r-- | src/tag/Mask.hxx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/tag/Mask.hxx b/src/tag/Mask.hxx index 76575ae5b..367857f60 100644 --- a/src/tag/Mask.hxx +++ b/src/tag/Mask.hxx @@ -28,67 +28,67 @@ class TagMask { typedef uint_least32_t mask_t; mask_t value; - explicit constexpr TagMask(uint_least32_t _value) + explicit constexpr TagMask(uint_least32_t _value) noexcept :value(_value) {} public: TagMask() = default; - constexpr TagMask(TagType tag) + constexpr TagMask(TagType tag) noexcept :value(mask_t(1) << mask_t(tag)) {} - static constexpr TagMask None() { + static constexpr TagMask None() noexcept { return TagMask(mask_t(0)); } - static constexpr TagMask All() { + static constexpr TagMask All() noexcept { return ~None(); } - constexpr TagMask operator~() const { + constexpr TagMask operator~() const noexcept { return TagMask(~value); } - constexpr TagMask operator&(TagMask other) const { + constexpr TagMask operator&(TagMask other) const noexcept { return TagMask(value & other.value); } - constexpr TagMask operator|(TagMask other) const { + constexpr TagMask operator|(TagMask other) const noexcept { return TagMask(value | other.value); } - constexpr TagMask operator^(TagMask other) const { + constexpr TagMask operator^(TagMask other) const noexcept { return TagMask(value ^ other.value); } - TagMask &operator&=(TagMask other) { + TagMask &operator&=(TagMask other) noexcept { value &= other.value; return *this; } - TagMask &operator|=(TagMask other) { + TagMask &operator|=(TagMask other) noexcept { value |= other.value; return *this; } - TagMask &operator^=(TagMask other) { + TagMask &operator^=(TagMask other) noexcept { value ^= other.value; return *this; } - constexpr bool TestAny() const { + constexpr bool TestAny() const noexcept { return value != 0; } - constexpr bool Test(TagType tag) const { + constexpr bool Test(TagType tag) const noexcept { return (*this & tag).TestAny(); } - void Set(TagType tag) { + void Set(TagType tag) noexcept { *this |= tag; } - void Unset(TagType tag) { + void Unset(TagType tag) noexcept { *this |= ~TagMask(tag); } }; |