aboutsummaryrefslogtreecommitdiff
path: root/include/Support/BitSetVector.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-06 18:34:40 +0000
committerChris Lattner <sabre@nondot.org>2002-11-06 18:34:40 +0000
commit45a9116e0a91f8a137bf548fad431d56ac99713d (patch)
tree6c586bff019180088b41abddd61b97c288a69a8b /include/Support/BitSetVector.h
parentd747e8ffe91205d30f2264ae9743ccd6811060b3 (diff)
Make maxSize a private variable, add a size() accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4573 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/Support/BitSetVector.h')
-rw-r--r--include/Support/BitSetVector.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/Support/BitSetVector.h b/include/Support/BitSetVector.h
index 0143413b3d..d7971b1b79 100644
--- a/include/Support/BitSetVector.h
+++ b/include/Support/BitSetVector.h
@@ -41,6 +41,7 @@ class BitSetVector {
class iterator;
std::vector<bitword> bitsetVec;
+ unsigned maxSize;
static unsigned NumWords(unsigned Size) { return (Size+WORDSIZE-1)/WORDSIZE;}
@@ -53,14 +54,15 @@ class BitSetVector {
BitSetVector(); // do not implement!
public:
- unsigned maxSize;
-
///
/// Constructor: create a set of the maximum size maxSetSize.
/// The set is initialized to empty.
///
BitSetVector(unsigned maxSetSize)
- : bitsetVec(BitSetVector::NumWords(maxSetSize)), maxSize(maxSetSize) { }
+ : bitsetVec(NumWords(maxSetSize)), maxSize(maxSetSize) { }
+
+ /// size - Return the number of bits tracked by this bit vector...
+ unsigned size() const { return maxSize; }
///
/// Modifier methods: reset, set for entire set, operator[] for one element.
@@ -229,7 +231,7 @@ inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset)
inline bool Disjoint(const BitSetVector& set1,
const BitSetVector& set2)
{
- assert(set1.maxSize == set2.maxSize && "Illegal intersection");
+ assert(set1.size() == set2.size() && "Illegal intersection");
for (unsigned i = 0; i < set1.bitsetVec.size(); ++i)
if ((set1.getWord(i) & set2.getWord(i)).any())
return false;