summaryrefslogtreecommitdiff
path: root/cpp/src/slice2objc/Gen.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-01-17 10:39:06 -0500
committerBernard Normier <bernard@zeroc.com>2017-01-17 10:39:06 -0500
commit53c1166f815e0860248a6bf0d7548aa52fa5c4e3 (patch)
tree7046892e4ff7e6babc068cc4a222aacd7ea0a04d /cpp/src/slice2objc/Gen.cpp
parentFixed hash algo for Long and Double (diff)
downloadice-53c1166f815e0860248a6bf0d7548aa52fa5c4e3.tar.bz2
ice-53c1166f815e0860248a6bf0d7548aa52fa5c4e3.tar.xz
ice-53c1166f815e0860248a6bf0d7548aa52fa5c4e3.zip
Revert "Fixed hash algo for Long and Double"
This reverts commit 2df92e167a62ae67401225086e165f82293446e9.
Diffstat (limited to 'cpp/src/slice2objc/Gen.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: