summaryrefslogtreecommitdiffstats
path: root/include/utils/BitSet.h
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-08-01 17:48:21 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-01 17:48:21 -0700
commit2a2ec87b55d423ae91385d4e9f51725154b7a272 (patch)
tree644a5b477891d6e2a6ac71cf3376cb60509f9f4b /include/utils/BitSet.h
parent8a2da33c77bae825444fffd326d064225241c7cc (diff)
parentbe1aa8250cee7819c49741e819e81659d1d03823 (diff)
downloadframeworks_base-2a2ec87b55d423ae91385d4e9f51725154b7a272.zip
frameworks_base-2a2ec87b55d423ae91385d4e9f51725154b7a272.tar.gz
frameworks_base-2a2ec87b55d423ae91385d4e9f51725154b7a272.tar.bz2
Merge "Refactor input reader to add stylus support. Bug: 5064702"
Diffstat (limited to 'include/utils/BitSet.h')
-rw-r--r--include/utils/BitSet.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h
index 600017e..9452e86 100644
--- a/include/utils/BitSet.h
+++ b/include/utils/BitSet.h
@@ -68,6 +68,30 @@ struct BitSet32 {
// Result is undefined if all bits are unmarked.
inline uint32_t lastMarkedBit() const { return 31 - __builtin_ctz(value); }
+ // Finds the first marked bit in the set and clears it. Returns the bit index.
+ // Result is undefined if all bits are unmarked.
+ inline uint32_t clearFirstMarkedBit() {
+ uint32_t n = firstMarkedBit();
+ clearBit(n);
+ return n;
+ }
+
+ // Finds the first unmarked bit in the set and marks it. Returns the bit index.
+ // Result is undefined if all bits are marked.
+ inline uint32_t markFirstUnmarkedBit() {
+ uint32_t n = firstUnmarkedBit();
+ markBit(n);
+ return n;
+ }
+
+ // Finds the last marked bit in the set and clears it. Returns the bit index.
+ // Result is undefined if all bits are unmarked.
+ inline uint32_t clearLastMarkedBit() {
+ uint32_t n = lastMarkedBit();
+ clearBit(n);
+ return n;
+ }
+
// 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 {