diff options
| author | Jim Laskey <jlaskey@mac.com> | 2006-10-29 09:19:59 +0000 |
|---|---|---|
| committer | Jim Laskey <jlaskey@mac.com> | 2006-10-29 09:19:59 +0000 |
| commit | 179ebd3fc335fb9c62a417a5d987d98c07a0fdb5 (patch) | |
| tree | e3056380c3b2d3ce19e60c4ff8a1ae24b2ec421f /llvm/lib/Support/FoldingSet.cpp | |
| parent | 8f05a611e951024dbd7d3a608df4de34d317a299 (diff) | |
| download | llvm-179ebd3fc335fb9c62a417a5d987d98c07a0fdb5.zip llvm-179ebd3fc335fb9c62a417a5d987d98c07a0fdb5.tar.gz llvm-179ebd3fc335fb9c62a417a5d987d98c07a0fdb5.tar.bz2 | |
Try again.
llvm-svn: 31278
Diffstat (limited to 'llvm/lib/Support/FoldingSet.cpp')
| -rw-r--r-- | llvm/lib/Support/FoldingSet.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp index 4fe67d7..1bd2014 100644 --- a/llvm/lib/Support/FoldingSet.cpp +++ b/llvm/lib/Support/FoldingSet.cpp @@ -51,6 +51,9 @@ void FoldingSetImpl::NodeID::AddDouble(double D) { } void FoldingSetImpl::NodeID::AddString(const std::string &String) { unsigned Size = String.size(); + Bits.push_back(Size); + if (!Size) return; + unsigned Units = Size / 4; unsigned Pos = 0; const unsigned *Base = (const unsigned *)String.data(); @@ -58,7 +61,7 @@ void FoldingSetImpl::NodeID::AddString(const std::string &String) { // If the string is aligned do a bulk transfer. if (!((intptr_t)Base & 3)) { Bits.append(Base, Base + Units); - Pos = Units * sizeof(unsigned); + Pos = (Units + 1) * 4; } else { // Otherwise do it the hard way. for ( Pos += 4; Pos <= Size; Pos += 4) { |
