[llvm-commits] CVS: llvm/include/llvm/ADT/BitVector.h
Reid Spencer
reid at x10sys.com
Thu Feb 15 12:49:28 PST 2007
Changes in directory llvm/include/llvm/ADT:
BitVector.h updated: 1.14 -> 1.15
---
Log message:
Fix an off-by-one bug in computing the index of the word to clear.
---
Diffs of the changes: (+4 -1)
BitVector.h | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
Index: llvm/include/llvm/ADT/BitVector.h
diff -u llvm/include/llvm/ADT/BitVector.h:1.14 llvm/include/llvm/ADT/BitVector.h:1.15
--- llvm/include/llvm/ADT/BitVector.h:1.14 Thu Feb 15 14:14:06 2007
+++ llvm/include/llvm/ADT/BitVector.h Thu Feb 15 14:49:10 2007
@@ -292,7 +292,10 @@
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);
}
}
More information about the llvm-commits
mailing list