mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Merge pull request #54095 from ClibMouse/feature/siphash128-reference-big-endian
Fix SipHash128 reference for big-endian platforms
This commit is contained in:
commit
0c8a6b9bbe
@ -200,11 +200,7 @@ public:
|
||||
ALWAYS_INLINE UInt128 get128()
|
||||
{
|
||||
UInt128 res;
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
get128(res.items[1], res.items[0]);
|
||||
#else
|
||||
get128(res.items[0], res.items[1]);
|
||||
#endif
|
||||
get128(res.items[UInt128::_impl::little(0)], res.items[UInt128::_impl::little(1)]);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -214,20 +210,13 @@ public:
|
||||
throw DB::Exception(
|
||||
DB::ErrorCodes::LOGICAL_ERROR, "Logical error: can't call get128Reference when is_reference_128 is not set");
|
||||
finalize();
|
||||
auto lo = v0 ^ v1 ^ v2 ^ v3;
|
||||
const auto lo = v0 ^ v1 ^ v2 ^ v3;
|
||||
v1 ^= 0xdd;
|
||||
SIPROUND;
|
||||
SIPROUND;
|
||||
SIPROUND;
|
||||
SIPROUND;
|
||||
auto hi = v0 ^ v1 ^ v2 ^ v3;
|
||||
|
||||
if constexpr (std::endian::native == std::endian::big)
|
||||
{
|
||||
lo = std::byteswap(lo);
|
||||
hi = std::byteswap(hi);
|
||||
std::swap(lo, hi);
|
||||
}
|
||||
const auto hi = v0 ^ v1 ^ v2 ^ v3;
|
||||
|
||||
UInt128 res = hi;
|
||||
res <<= 64;
|
||||
|
Loading…
Reference in New Issue
Block a user