From 8776f424ac8a7fe3f50ccf0232a7dea815b5df77 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Mon, 12 Jul 2021 22:43:58 +0430 Subject: [PATCH] AK: Make Traits use ptr_hash() and not assume 32-bit pointers As a nice bonus, it also simplifies the code quite a bit. --- AK/Traits.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/AK/Traits.h b/AK/Traits.h index 2f20cb82a997fb..e6a973ae649d1b 100644 --- a/AK/Traits.h +++ b/AK/Traits.h @@ -36,13 +36,9 @@ requires(IsIntegral) struct Traits : public GenericTraits { }; template -struct Traits : public GenericTraits { - static unsigned hash(const T* p) - { - return int_hash((unsigned)(__PTRDIFF_TYPE__)p); - } +requires(IsPointer) struct Traits : public GenericTraits { + static unsigned hash(T p) { return ptr_hash((FlatPtr)p); } static constexpr bool is_trivial() { return true; } - static bool equals(const T* a, const T* b) { return a == b; } }; }