summaryrefslogtreecommitdiffstats
path: root/include/utils/BitSet.h
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-03-15 20:01:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-15 20:01:16 -0700
commit843e29d3751017267b96565c543df0301c31a9f7 (patch)
tree80277ab21b62650bb613dc6b7df062c4c7cc9963 /include/utils/BitSet.h
parent437c2c1620d0a485a4f81fdb0aaf706d89b865e7 (diff)
parent2ed2462aa29c564f5231f317c27b3188da875e52 (diff)
downloadframeworks_base-843e29d3751017267b96565c543df0301c31a9f7.zip
frameworks_base-843e29d3751017267b96565c543df0301c31a9f7.tar.gz
frameworks_base-843e29d3751017267b96565c543df0301c31a9f7.tar.bz2
Merge "Improve VelocityTracker numerical stability."
Diffstat (limited to 'include/utils/BitSet.h')
-rw-r--r--include/utils/BitSet.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h
index f03825a..de748b5 100644
--- a/include/utils/BitSet.h
+++ b/include/utils/BitSet.h
@@ -61,6 +61,10 @@ struct BitSet32 {
// Result is undefined if all bits are marked.
inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); }
+ // Finds the last marked bit in the set.
+ // Result is undefined if all bits are unmarked.
+ inline uint32_t lastMarkedBit() const { return 31 - __builtin_ctz(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 {