diff options
Diffstat (limited to 'include/utils')
-rw-r--r-- | include/utils/BitSet.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h index 19c8bf0..f5dbcd9 100644 --- a/include/utils/BitSet.h +++ b/include/utils/BitSet.h @@ -38,6 +38,9 @@ struct BitSet32 { // Clears the bit set. inline void clear() { value = 0; } + // Returns the number of marked bits in the set. + inline uint32_t count() const { return __builtin_popcount(value); } + // Returns true if the bit set does not contain any marked bits. inline bool isEmpty() const { return ! value; } |