diff options
| author | 2011-03-14 14:12:51 -0700 | |
|---|---|---|
| committer | 2011-03-14 14:12:51 -0700 | |
| commit | 67a79e18009a0cad1a98d0aa53656ef77f8986bc (patch) | |
| tree | 840358c5537173a97a09659815656fae5e4b4ce7 /include/utils/BitSet.h | |
| parent | bf62cf5e7c114a36780e035cc9e6712b3e7a2b9c (diff) | |
| parent | fa773aa745325263745202f822335dfeec0e4c67 (diff) | |
Merge "Use touch pad gestures to manipulate the pointer."
Diffstat (limited to 'include/utils/BitSet.h')
| -rw-r--r-- | include/utils/BitSet.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h index f5dbcd9422..f03825ae0f 100644 --- a/include/utils/BitSet.h +++ b/include/utils/BitSet.h @@ -61,6 +61,12 @@ struct BitSet32 { // Result is undefined if all bits are marked. inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); } + // Gets the index of the specified bit in the set, which is the number of + // marked bits that appear before the specified bit. + inline uint32_t getIndexOfBit(uint32_t n) const { + return __builtin_popcount(value & ~(0xffffffffUL >> n)); + } + inline bool operator== (const BitSet32& other) const { return value == other.value; } inline bool operator!= (const BitSet32& other) const { return value != other.value; } }; |