summaryrefslogtreecommitdiff
path: root/cpp/src/slice2objc/Gen.cpp
diff options
context:
space:
mode:
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: