From 9049710051c24e7177525261c07d959e68da0532 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 12 Feb 2025 23:42:46 +0000 Subject: [PATCH] Codechange: Allow (Re)setting a range of values in a BaseBitSet. --- src/core/base_bitset_type.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/core/base_bitset_type.hpp b/src/core/base_bitset_type.hpp index e313c9a2c9..43da1d2983 100644 --- a/src/core/base_bitset_type.hpp +++ b/src/core/base_bitset_type.hpp @@ -52,6 +52,17 @@ public: return static_cast(*this); } + /** + * Set values from another bitset. + * @param other Bitset of values to set. + * @returns The bit set + */ + inline constexpr Timpl &Set(const Timpl &other) + { + this->data |= other.data; + return static_cast(*this); + } + /** * Assign the value-th bit. * @param value Bit to assign to. @@ -74,6 +85,17 @@ public: return static_cast(*this); } + /** + * Reset values from another bitset. + * @param other Bitset of values to reset. + * @returns The bit set + */ + inline constexpr Timpl &Reset(const Timpl &other) + { + this->data &= ~other.data; + return static_cast(*this); + } + /** * Flip the value-th bit. * @param value Bit to flip. @@ -88,6 +110,17 @@ public: } } + /** + * Flip values from another bitset. + * @param other Bitset of values to flip. + * @returns The bit set + */ + inline constexpr Timpl &Flip(const Timpl &other) + { + this->data ^= other.data; + return static_cast(*this); + } + /** * Test if the value-th bit is set. * @param value Bit to check.