Fix DefaultHash64 for s390x

This commit is contained in:
HarryLeeIBM 2023-05-12 06:00:47 -07:00
parent a2eaa79b37
commit 809fdc7b16

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);
}