BitVector::count() bugs.

llvm-svn: 34314
This commit is contained in:
Evan Cheng 2007-02-15 19:09:36 +00:00
parent 6194cdc7b8
commit b959dc3746
1 changed files with 6 additions and 1 deletions

View File

@ -101,7 +101,12 @@ public:
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;
}