mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
fix ub type punning
This commit is contained in:
parent
d02d1fd489
commit
7f28a89273
@ -224,14 +224,9 @@ template <typename T>
|
|||||||
requires (sizeof(T) <= sizeof(UInt64))
|
requires (sizeof(T) <= sizeof(UInt64))
|
||||||
inline size_t hashCRC32(T key, DB::UInt64 updated_value = -1)
|
inline size_t hashCRC32(T key, DB::UInt64 updated_value = -1)
|
||||||
{
|
{
|
||||||
union
|
DB::UInt64 out {0};
|
||||||
{
|
std::memcpy(&out, &key, sizeof(T));
|
||||||
T in;
|
return intHashCRC32(out, updated_value);
|
||||||
DB::UInt64 out;
|
|
||||||
} u;
|
|
||||||
u.out = 0;
|
|
||||||
u.in = key;
|
|
||||||
return intHashCRC32(u.out, updated_value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user