diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-08-21 16:32:43 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-08-21 16:32:43 +0200 |
commit | 35686a1432bf56ae8729f5e164d4a9defbee399b (patch) | |
tree | 4f0bb4baa26c82c581c154a2593e3a95bbce98fc /cpp/src/slice2objc/Gen.cpp | |
parent | Fixed ICE-8423 - backport of leak fixes (diff) | |
download | ice-35686a1432bf56ae8729f5e164d4a9defbee399b.tar.bz2 ice-35686a1432bf56ae8729f5e164d4a9defbee399b.tar.xz ice-35686a1432bf56ae8729f5e164d4a9defbee399b.zip |
Fixed ICE-8421 - warnings from generated code hash methods
Diffstat (limited to 'cpp/src/slice2objc/Gen.cpp')
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 9c9ea276ca4..80135073987 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -1592,7 +1592,7 @@ Slice::Gen::TypesVisitor::writeConstantValue(IceUtilInternal::Output& out, const break; } } - + out << val[i]; // Print normally if in basic source character set } ++i; @@ -2070,13 +2070,24 @@ Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers, BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(builtin) { - if(builtin->kind() == Builtin::KindFloat || builtin->kind() == Builtin::KindDouble) - { - _M << "(2654435761u * (uint)" << name << ");"; - } - else + switch(builtin->kind()) { - _M << "(2654435761u * " << name << ");"; + case Builtin::KindLong: + { + _M << nl << "(uint)(" << name << " ^ (" << name << " >> 32));"; + break; + } + case Builtin::KindFloat: + case Builtin::KindDouble: + { + _M << nl << "[@(" << name << ") hash];"; + break; + } + default: + { + _M << "(2654435761u * " << name << ");"; + break; + } } } else |