aboutsummaryrefslogtreecommitdiffstats
path: root/chilbert/FixBitVec.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-12 22:27:55 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:46:27 +0200
commitc28ab4461fd7868cff200283cc4cf6aded0f331f (patch)
tree012e9f873a6e5f10192ca9ee1ae8c3c6f859c036 /chilbert/FixBitVec.hpp
parent50145430b5fb08802bc22a6ae06351a11a091c60 (diff)
downloadchilbert-c28ab4461fd7868cff200283cc4cf6aded0f331f.tar.gz
chilbert-c28ab4461fd7868cff200283cc4cf6aded0f331f.tar.bz2
chilbert-c28ab4461fd7868cff200283cc4cf6aded0f331f.zip
Add pop count operations
Diffstat (limited to 'chilbert/FixBitVec.hpp')
-rw-r--r--chilbert/FixBitVec.hpp3
1 files changed, 3 insertions, 0 deletions
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<size_t>(chilbert::ffs(m_rack));
}
+ /// Return the number of set bits
+ size_t count() const { return static_cast<size_t>(pop_count(m_rack)); }
+
/// Flip all bits (one's complement)
CFixBitVec& flip()
{