From 7c4a75add8ee00eb791aa074e84c608c9bcf7c5f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 11 Aug 2018 18:53:23 +0200 Subject: Add methods to set all bits --- chilbert/BigBitVec.hpp | 7 +++++++ chilbert/FixBitVec.hpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/chilbert/BigBitVec.hpp b/chilbert/BigBitVec.hpp index 1f97039..7a1b49a 100644 --- a/chilbert/BigBitVec.hpp +++ b/chilbert/BigBitVec.hpp @@ -75,6 +75,13 @@ public: return *this; } + /// Set all bits to one + CBigBitVec& set() + { + memset(m_pcRacks.get(), 0xFF, sizeof(CFixBitVec) * m_iRacks); + return *this; + } + /// Truncate to a given precision in bits (zero MSBs) CBigBitVec& truncate(const int bits) { diff --git a/chilbert/FixBitVec.hpp b/chilbert/FixBitVec.hpp index 2106aa5..ac02e40 100644 --- a/chilbert/FixBitVec.hpp +++ b/chilbert/FixBitVec.hpp @@ -43,6 +43,13 @@ public: /// Return the size in bits int size() const { return FBV_BITS; } + /// Set all bits to one + CFixBitVec& set() + { + m_rack = FBV1S; + return *this; + } + /// Set all bits to zero CFixBitVec& reset() { -- cgit v1.2.1