From c28ab4461fd7868cff200283cc4cf6aded0f331f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 12 Aug 2018 22:27:55 +0200 Subject: Add pop count operations --- chilbert/FixBitVec.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'chilbert/FixBitVec.hpp') diff --git a/chilbert/FixBitVec.hpp b/chilbert/FixBitVec.hpp index e47b868..bba25d9 100644 --- a/chilbert/FixBitVec.hpp +++ b/chilbert/FixBitVec.hpp @@ -224,6 +224,9 @@ public: return static_cast(chilbert::ffs(m_rack)); } + /// Return the number of set bits + size_t count() const { return static_cast(pop_count(m_rack)); } + /// Flip all bits (one's complement) CFixBitVec& flip() { -- cgit v1.2.1