|
@@ -10,7 +10,6 @@
|
|
|
#include <AK/Concepts.h>
|
|
|
#include <AK/Forward.h>
|
|
|
#include <AK/HashFunctions.h>
|
|
|
-#include <AK/SipHash.h>
|
|
|
#include <AK/StringHash.h>
|
|
|
|
|
|
namespace AK {
|
|
@@ -41,7 +40,10 @@ struct Traits<T> : public DefaultTraits<T> {
|
|
|
static constexpr bool is_trivially_serializable() { return true; }
|
|
|
static unsigned hash(T value)
|
|
|
{
|
|
|
- return standard_sip_hash(static_cast<u64>(value));
|
|
|
+ if constexpr (sizeof(T) < 8)
|
|
|
+ return int_hash(value);
|
|
|
+ else
|
|
|
+ return u64_hash(value);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -52,14 +54,17 @@ struct Traits<T> : public DefaultTraits<T> {
|
|
|
static constexpr bool is_trivially_serializable() { return true; }
|
|
|
static unsigned hash(T value)
|
|
|
{
|
|
|
- return standard_sip_hash(bit_cast<u64>(static_cast<double>(value)));
|
|
|
+ if constexpr (sizeof(T) < 8)
|
|
|
+ return int_hash(bit_cast<u32>(value));
|
|
|
+ else
|
|
|
+ return u64_hash(bit_cast<u64>(value));
|
|
|
}
|
|
|
};
|
|
|
#endif
|
|
|
|
|
|
template<typename T>
|
|
|
requires(IsPointer<T> && !Detail::IsPointerOfType<char, T>) struct Traits<T> : public DefaultTraits<T> {
|
|
|
- static unsigned hash(T p) { return standard_sip_hash(bit_cast<FlatPtr>(p)); }
|
|
|
+ static unsigned hash(T p) { return ptr_hash(bit_cast<FlatPtr>(p)); }
|
|
|
static constexpr bool is_trivial() { return true; }
|
|
|
};
|
|
|
|