AK: Make traits for NonnullOwnPtr use ptr_hash instead of int_hash

Otherwise they'd be truncating the pointer in 64-bit builds.
This commit is contained in:
Ali Mohammad Pur 2021-09-11 16:45:04 +04:30 committed by Ali Mohammad Pur
parent 7632cce5e5
commit a21a3c2620
Notes: sideshowbarker 2024-07-18 04:03:50 +09:00

View File

@ -176,7 +176,7 @@ template<typename T>
struct Traits<NonnullOwnPtr<T>> : public GenericTraits<NonnullOwnPtr<T>> {
using PeekType = T*;
using ConstPeekType = const T*;
static unsigned hash(const NonnullOwnPtr<T>& p) { return int_hash((u32)p.ptr()); }
static unsigned hash(const NonnullOwnPtr<T>& p) { return ptr_hash((FlatPtr)p.ptr()); }
static bool equals(const NonnullOwnPtr<T>& a, const NonnullOwnPtr<T>& b) { return a.ptr() == b.ptr(); }
};