[llvm-commits] CVS: llvm/include/llvm/ADT/BitVector.h

Evan Cheng evan.cheng at apple.com
Thu Feb 15 11:09:56 PST 2007



Changes in directory llvm/include/llvm/ADT:

BitVector.h updated: 1.6 -> 1.7
---
Log message:

BitVector::count() bugs.

---
Diffs of the changes:  (+6 -1)

 BitVector.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/ADT/BitVector.h
diff -u llvm/include/llvm/ADT/BitVector.h:1.6 llvm/include/llvm/ADT/BitVector.h:1.7
--- llvm/include/llvm/ADT/BitVector.h:1.6	Thu Feb 15 13:05:25 2007
+++ llvm/include/llvm/ADT/BitVector.h	Thu Feb 15 13:09:36 2007
@@ -101,7 +101,12 @@
   unsigned count() const {
     unsigned NumBits = 0;
     for (unsigned i = 0; i < NumBitWords(size()); ++i)
-      NumBits = CountPopulation_32(Bits[i]);
+      if (sizeof(BitWord) == 4)
+        NumBits += CountPopulation_32(Bits[i]);
+      else if (sizeof(BitWord) == 8)
+        NumBits += CountPopulation_64(Bits[i]);
+      else
+        assert(0 && "Unsupported!")
     return NumBits;
   }
 






More information about the llvm-commits mailing list