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
This commit is contained in:
Dan Gohman
2010-09-27 15:48:37 +00:00
parent 4c6809d8e3
commit fab4c9e9df
4 changed files with 27 additions and 0 deletions

View File

@ -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())