summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-01-17 09:45:58 -0500
committerBernard Normier <bernard@zeroc.com>2017-01-17 09:45:58 -0500
commit641918f4aa3226e29f82b26ef6cb9d3f3f6ee84c (patch)
tree7046892e4ff7e6babc068cc4a222aacd7ea0a04d /cpp
parentFixed hash algo for Long and Double (diff)
downloadice-641918f4aa3226e29f82b26ef6cb9d3f3f6ee84c.tar.bz2
ice-641918f4aa3226e29f82b26ef6cb9d3f3f6ee84c.tar.xz
ice-641918f4aa3226e29f82b26ef6cb9d3f3f6ee84c.zip
Revert "Fixed hash algo for Long and Double"
This reverts commit 175f5f59aced4220bf8c6e06446b86b8461cde9b.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/slice2objc/Gen.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp
index 718204ecab6..d3316087916 100644
--- a/cpp/src/slice2objc/Gen.cpp
+++ b/cpp/src/slice2objc/Gen.cpp
@@ -2035,7 +2035,7 @@ Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers,
{
case Builtin::KindLong:
{
- _M << nl << "h_ = ((h_ << 5) + h_) ^ [@(" << name << ") hash];";
+ _M << nl << "h_ = ((h_ << 5) + h_) ^ (uint)(" << name << " ^ (" << name << " >> 32));";
break;
}
case Builtin::KindFloat:
@@ -2045,7 +2045,10 @@ Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers,
}
case Builtin::KindDouble:
{
- _M << nl << "h_ = ((h_ << 5) + h_) ^ [@(" << name << ") hash];";
+ _M << sb;
+ _M << nl << "unsigned long long bits_ = (unsigned long long)" << name << ";";
+ _M << nl << "h_ = ((h_ << 5) + h_) ^ (uint)(bits_ ^ (bits_ >> 32));";
+ _M << eb;
break;
}
default: