Merge pull request #49833 from HarryLeeIBM/hlee-s390x-simple-agg

Fix DefaultHash64 for s390x
This commit is contained in:
Alexey Milovidov 2023-05-13 01:00:36 +03:00 committed by GitHub
commit efc5e69aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,7 +251,10 @@ requires (sizeof(T) <= sizeof(UInt64))
inline size_t DefaultHash64(T key)
{
DB::UInt64 out {0};
std::memcpy(&out, &key, sizeof(T));
if constexpr (std::endian::native == std::endian::little)
std::memcpy(&out, &key, sizeof(T));
else
std::memcpy(reinterpret_cast<char*>(&out) + sizeof(DB::UInt64) - sizeof(T), &key, sizeof(T));
return intHash64(out);
}