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/BitVector.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/BitVector.h')
-rw-r--r-- | include/llvm/ADT/BitVector.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h index 9dcb9e106f..1940fd3900 100644 --- a/include/llvm/ADT/BitVector.h +++ b/include/llvm/ADT/BitVector.h @@ -127,6 +127,12 @@ public: return false; } + /// all - Returns true if all bits are set. + bool all() const { + // TODO: Optimize this. + return count() == size(); + } + /// none - Returns true if none of the bits are set. bool none() const { return !any(); |