fix ub type punning

This commit is contained in:
Yakov Olkhovskiy 2022-11-09 09:39:27 -05:00 committed by GitHub
parent d02d1fd489
commit 7f28a89273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,14 +224,9 @@ template <typename T>
requires (sizeof(T) <= sizeof(UInt64))
inline size_t hashCRC32(T key, DB::UInt64 updated_value = -1)
{
union
{
T in;
DB::UInt64 out;
} u;
u.out = 0;
u.in = key;
return intHashCRC32(u.out, updated_value);
DB::UInt64 out {0};
std::memcpy(&out, &key, sizeof(T));
return intHashCRC32(out, updated_value);
}
template <typename T>