[llvm-commits] CVS: llvm/include/llvm/ADT/BitVector.h
Evan Cheng
evan.cheng at apple.com
Thu Feb 15 13:38:32 PST 2007
Changes in directory llvm/include/llvm/ADT:
BitVector.h updated: 1.15 -> 1.16
---
Log message:
Proper fix for the off-by-one bug in clear_unused_bits().
---
Diffs of the changes: (+3 -5)
BitVector.h | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
Index: llvm/include/llvm/ADT/BitVector.h
diff -u llvm/include/llvm/ADT/BitVector.h:1.15 llvm/include/llvm/ADT/BitVector.h:1.16
--- llvm/include/llvm/ADT/BitVector.h:1.15 Thu Feb 15 14:49:10 2007
+++ llvm/include/llvm/ADT/BitVector.h Thu Feb 15 15:38:15 2007
@@ -290,12 +290,10 @@
// 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);
}
}
More information about the llvm-commits
mailing list