diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-12 22:43:58 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-07-12 23:49:59 +0430 |
commit | 8776f424ac8a7fe3f50ccf0232a7dea815b5df77 (patch) | |
tree | f94c5963c20f5c7130b8066d5aeb8dd34dd2f446 /AK | |
parent | ad328f852b8e366f29ca481ef4699703204ad799 (diff) | |
download | serenity-8776f424ac8a7fe3f50ccf0232a7dea815b5df77.zip |
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.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Traits.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/AK/Traits.h b/AK/Traits.h index 2f20cb82a9..e6a973ae64 100644 --- a/AK/Traits.h +++ b/AK/Traits.h @@ -36,13 +36,9 @@ requires(IsIntegral<T>) struct Traits<T> : public GenericTraits<T> { }; template<typename T> -struct Traits<T*> : public GenericTraits<T*> { - static unsigned hash(const T* p) - { - return int_hash((unsigned)(__PTRDIFF_TYPE__)p); - } +requires(IsPointer<T>) struct Traits<T> : public GenericTraits<T> { + 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; } }; } |