summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FoldingSet.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-10-29 09:19:59 +0000
committerJim Laskey <jlaskey@mac.com>2006-10-29 09:19:59 +0000
commit179ebd3fc335fb9c62a417a5d987d98c07a0fdb5 (patch)
treee3056380c3b2d3ce19e60c4ff8a1ae24b2ec421f /llvm/lib/Support/FoldingSet.cpp
parent8f05a611e951024dbd7d3a608df4de34d317a299 (diff)
downloadbcm5719-llvm-179ebd3fc335fb9c62a417a5d987d98c07a0fdb5.tar.gz
bcm5719-llvm-179ebd3fc335fb9c62a417a5d987d98c07a0fdb5.zip
Try again.
llvm-svn: 31278
Diffstat (limited to 'llvm/lib/Support/FoldingSet.cpp')
-rw-r--r--llvm/lib/Support/FoldingSet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index 4fe67d7895e..1bd20145f45 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) {
OpenPOWER on IntegriCloud