Proper fix for the off-by-one bug in clear_unused_bits().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-02-15 21:38:15 +00:00
parent 1500515406
commit b5aabee330

View File

@ -290,12 +290,10 @@ private:
// Clear the unused top bits in the high word.
void clear_unused_bits() {
if (Size) {
unsigned ExtraBits = Size % BITS_PER_WORD;
unsigned ExtraBits = Size % BITS_PER_WORD;
if (ExtraBits) {
unsigned index = Size / BITS_PER_WORD;
if (Size % BITS_PER_WORD == 0)
index--;
Bits[index] &= ~(~0 << ExtraBits);
Bits[index] &= ~(~0L << ExtraBits);
}
}