1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

AK: Make Traits<T*> use ptr_hash() and not assume 32-bit pointers

As a nice bonus, it also simplifies the code quite a bit.
This commit is contained in:
Ali Mohammad Pur 2021-07-12 22:43:58 +04:30 committed by Ali Mohammad Pur
parent ad328f852b
commit 8776f424ac

View file

@ -36,13 +36,9 @@ requires(IsIntegral<T>) struct Traits<T> : public GenericTraits<T> {
}; };
template<typename T> template<typename T>
struct Traits<T*> : public GenericTraits<T*> { requires(IsPointer<T>) struct Traits<T> : public GenericTraits<T> {
static unsigned hash(const T* p) static unsigned hash(T p) { return ptr_hash((FlatPtr)p); }
{
return int_hash((unsigned)(__PTRDIFF_TYPE__)p);
}
static constexpr bool is_trivial() { return true; } static constexpr bool is_trivial() { return true; }
static bool equals(const T* a, const T* b) { return a == b; }
}; };
} }