[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

Jim Laskey jlaskey at apple.com
Sun Oct 29 01:20:20 PST 2006



Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.7 -> 1.8
---
Log message:

Try again.

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

 FoldingSet.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.7 llvm/lib/Support/FoldingSet.cpp:1.8
--- llvm/lib/Support/FoldingSet.cpp:1.7	Sun Oct 29 02:27:07 2006
+++ llvm/lib/Support/FoldingSet.cpp	Sun Oct 29 03:19:59 2006
@@ -51,6 +51,9 @@
 }
 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 @@
   // 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) {






More information about the llvm-commits mailing list