diff options
author | Dan Gohman <gohman@apple.com> | 2010-09-27 15:48:37 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-09-27 15:48:37 +0000 |
commit | fab4c9e9df1aeb33b55cfcfa174fac8d61df96fd (patch) | |
tree | 182d681133d46af18a2b80ba257b30588b7b93d8 /include/llvm/ADT/SmallBitVector.h | |
parent | 4c6809d8e38b9690898700085ebbd913e035c2e2 (diff) |
Add an all() method to BitVector, for testing whether all bits are set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/SmallBitVector.h')
-rw-r--r-- | include/llvm/ADT/SmallBitVector.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/ADT/SmallBitVector.h b/include/llvm/ADT/SmallBitVector.h index 3441d0a90c..b15b3ee041 100644 --- a/include/llvm/ADT/SmallBitVector.h +++ b/include/llvm/ADT/SmallBitVector.h @@ -187,6 +187,13 @@ public: return getPointer()->any(); } + /// all - Returns true if all bits are set. + bool all() const { + if (isSmall()) + return getSmallBits() == (uintptr_t(1) << getSmallSize()) - 1; + return getPointer()->all(); + } + /// none - Returns true if none of the bits are set. bool none() const { if (isSmall()) |