From 641918f4aa3226e29f82b26ef6cb9d3f3f6ee84c Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Tue, 17 Jan 2017 09:45:58 -0500 Subject: Revert "Fixed hash algo for Long and Double" This reverts commit 175f5f59aced4220bf8c6e06446b86b8461cde9b. --- cpp/src/slice2objc/Gen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpp/src/slice2objc/Gen.cpp') 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: -- cgit v1.2.3