From: Reid Spencer Date: Thu, 15 Feb 2007 20:49:10 +0000 (+0000) Subject: Fix an off-by-one bug in computing the index of the word to clear. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f1f007d2ffeb5534070208938aaa7f3065d70f61;p=oota-llvm.git 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 --- diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h index 39819ee5c82..79c3f585677 100644 --- a/include/llvm/ADT/BitVector.h +++ b/include/llvm/ADT/BitVector.h @@ -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); } }