Fix an off-by-one bug in computing the index of the word to clear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-02-15 20:49:10 +00:00
parent 9d1597b086
commit f1f007d2ff

View File

@ -292,7 +292,10 @@ private:
void clear_unused_bits() {
if (Size) {
unsigned ExtraBits = Size % BITS_PER_WORD;
Bits[Size / BITS_PER_WORD] &= ~(~0 << ExtraBits);
unsigned index = Size / BITS_PER_WORD;
if (Size % BITS_PER_WORD == 0)
index--;
Bits[index] &= ~(~0 << ExtraBits);
}
}