From e0dbbbb0320b9a43096052f0da07831a26c162c0 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 6 May 2025 20:07:45 +0100 Subject: [PATCH] Codechange: Add Reset() and missing &=/|= operators for BaseBitSet. --- src/core/base_bitset_type.hpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/core/base_bitset_type.hpp b/src/core/base_bitset_type.hpp index aaea935658..c88bc4b9a8 100644 --- a/src/core/base_bitset_type.hpp +++ b/src/core/base_bitset_type.hpp @@ -76,6 +76,16 @@ public: return set ? this->Set(value) : this->Reset(value); } + /** + * Reset all bits. + * @returns The bit set + */ + inline constexpr Timpl &Reset() + { + this->data = 0; + return static_cast(*this); + } + /** * Reset the value-th bit. * @param value Bit to reset. @@ -180,12 +190,24 @@ public: return this->data == 0; } - inline constexpr Timpl operator |(const Timpl &other) const + inline constexpr Timpl &operator|=(const Timpl &other) + { + this->data |= other.data; + return static_cast(*this); + } + + inline constexpr Timpl operator|(const Timpl &other) const { return Timpl{static_cast(this->data | other.data)}; } - inline constexpr Timpl operator &(const Timpl &other) const + inline constexpr Timpl &operator&=(const Timpl &other) + { + this->data &= other.data; + return static_cast(*this); + } + + inline constexpr Timpl operator&(const Timpl &other) const { return Timpl{static_cast(this->data & other.data)}; }