diff --git a/AK/Traits.h b/AK/Traits.h index b6f35573820..f098f50e32e 100644 --- a/AK/Traits.h +++ b/AK/Traits.h @@ -10,7 +10,6 @@ #include #include #include -#include #include namespace AK { @@ -41,7 +40,10 @@ struct Traits : public DefaultTraits { static constexpr bool is_trivially_serializable() { return true; } static unsigned hash(T value) { - return standard_sip_hash(static_cast(value)); + if constexpr (sizeof(T) < 8) + return int_hash(value); + else + return u64_hash(value); } }; @@ -52,14 +54,17 @@ struct Traits : public DefaultTraits { static constexpr bool is_trivially_serializable() { return true; } static unsigned hash(T value) { - return standard_sip_hash(bit_cast(static_cast(value))); + if constexpr (sizeof(T) < 8) + return int_hash(bit_cast(value)); + else + return u64_hash(bit_cast(value)); } }; #endif template requires(IsPointer && !Detail::IsPointerOfType) struct Traits : public DefaultTraits { - static unsigned hash(T p) { return standard_sip_hash(bit_cast(p)); } + static unsigned hash(T p) { return ptr_hash(bit_cast(p)); } static constexpr bool is_trivial() { return true; } };