llvm.org GIT mirror llvm / 45a9116
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 Chris Lattner 17 years ago
2 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
4040 class iterator;
4141
4242 std::vector bitsetVec;
43 unsigned maxSize;
4344
4445 static unsigned NumWords(unsigned Size) { return (Size+WORDSIZE-1)/WORDSIZE;}
4546
5253 BitSetVector(); // do not implement!
5354
5455 public:
55 unsigned maxSize;
56
5756 ///
5857 /// Constructor: create a set of the maximum size maxSetSize.
5958 /// The set is initialized to empty.
6059 ///
6160 BitSetVector(unsigned maxSetSize)
62 : bitsetVec(BitSetVector::NumWords(maxSetSize)), maxSize(maxSetSize) { }
61 : bitsetVec(NumWords(maxSetSize)), maxSize(maxSetSize) { }
62
63 /// size - Return the number of bits tracked by this bit vector...
64 unsigned size() const { return maxSize; }
6365
6466 ///
6567 /// Modifier methods: reset, set for entire set, operator[] for one element.
228230 inline bool Disjoint(const BitSetVector& set1,
229231 const BitSetVector& set2)
230232 {
231 assert(set1.maxSize == set2.maxSize && "Illegal intersection");
233 assert(set1.size() == set2.size() && "Illegal intersection");
232234 for (unsigned i = 0; i < set1.bitsetVec.size(); ++i)
233235 if ((set1.getWord(i) & set2.getWord(i)).any())
234236 return false;
4040 class iterator;
4141
4242 std::vector bitsetVec;
43 unsigned maxSize;
4344
4445 static unsigned NumWords(unsigned Size) { return (Size+WORDSIZE-1)/WORDSIZE;}
4546
5253 BitSetVector(); // do not implement!
5354
5455 public:
55 unsigned maxSize;
56
5756 ///
5857 /// Constructor: create a set of the maximum size maxSetSize.
5958 /// The set is initialized to empty.
6059 ///
6160 BitSetVector(unsigned maxSetSize)
62 : bitsetVec(BitSetVector::NumWords(maxSetSize)), maxSize(maxSetSize) { }
61 : bitsetVec(NumWords(maxSetSize)), maxSize(maxSetSize) { }
62
63 /// size - Return the number of bits tracked by this bit vector...
64 unsigned size() const { return maxSize; }
6365
6466 ///
6567 /// Modifier methods: reset, set for entire set, operator[] for one element.
228230 inline bool Disjoint(const BitSetVector& set1,
229231 const BitSetVector& set2)
230232 {
231 assert(set1.maxSize == set2.maxSize && "Illegal intersection");
233 assert(set1.size() == set2.size() && "Illegal intersection");
232234 for (unsigned i = 0; i < set1.bitsetVec.size(); ++i)
233235 if ((set1.getWord(i) & set2.getWord(i)).any())
234236 return false;