out-of-bounds bit accesses. The checks are only performed
in a Debug build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44815
91177308-0d34-0410-b5e6-
96231b3b80d8
// Indexing.
reference operator[](unsigned Idx) {
+ assert (Idx < Size && "Out-of-bounds Bit access.");
return reference(*this, Idx);
}
bool operator[](unsigned Idx) const {
+ assert (Idx < Size && "Out-of-bounds Bit access.");
BitWord Mask = 1L << (Idx % BITWORD_SIZE);
return (Bits[Idx / BITWORD_SIZE] & Mask) != 0;
}
// Destroy the old bits.
delete[] Bits;
Bits = NewBits;
+
+ clear_unused_bits();
}
void init_words(BitWord *B, unsigned NumWords, bool t) {