summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/BitVector.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-02-15 19:09:36 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-02-15 19:09:36 +0000
commit7bf26c1d68f75de9c1c8520620228b016bf9a0eb (patch)
tree196a2b6460aaf95f113ed151ff524c468d49e675 /include/llvm/ADT/BitVector.h
parent334df9d83f7a9f189d21c25a2d32afcd50bd0a9a (diff)
downloadllvm-7bf26c1d68f75de9c1c8520620228b016bf9a0eb.tar.gz
llvm-7bf26c1d68f75de9c1c8520620228b016bf9a0eb.tar.bz2
llvm-7bf26c1d68f75de9c1c8520620228b016bf9a0eb.tar.xz
BitVector::count() bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/BitVector.h')
-rw-r--r--include/llvm/ADT/BitVector.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index a6ae1ac80d..03789aa4ff 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -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;
}