diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-15 20:49:10 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-15 20:49:10 +0000 |
commit | f1f007d2ffeb5534070208938aaa7f3065d70f61 (patch) | |
tree | 21ef1a6b3c6f44c587d1e1fe879538636426887f /include/llvm/ADT/BitVector.h | |
parent | 9d1597b086114d643a8c5db71fffa72ae8bb06f3 (diff) | |
download | llvm-f1f007d2ffeb5534070208938aaa7f3065d70f61.tar.gz llvm-f1f007d2ffeb5534070208938aaa7f3065d70f61.tar.bz2 llvm-f1f007d2ffeb5534070208938aaa7f3065d70f61.tar.xz |
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
Diffstat (limited to 'include/llvm/ADT/BitVector.h')
-rw-r--r-- | include/llvm/ADT/BitVector.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h index 39819ee5c8..79c3f58567 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); } } |