AK: Use int_hash() to generate less idiotic hashes for {Nonnull,}OwnPtr

This commit is contained in:
Andreas Kling 2019-08-14 21:21:15 +02:00
parent e0395d5ebe
commit eaa9cf58f5
Notes: sideshowbarker 2024-07-19 12:40:48 +09:00
2 changed files with 2 additions and 2 deletions

View file

@ -143,7 +143,7 @@ make(Args&&... args)
template<typename T>
struct Traits<NonnullOwnPtr<T>> : public GenericTraits<NonnullOwnPtr<T>> {
using PeekType = const T*;
static unsigned hash(const NonnullOwnPtr<T>& p) { return (unsigned)p.ptr(); }
static unsigned hash(const NonnullOwnPtr<T>& p) { return int_hash((u32)p.ptr()); }
static void dump(const NonnullOwnPtr<T>& p) { kprintf("%p", p.ptr()); }
static bool equals(const NonnullOwnPtr<T>& a, const NonnullOwnPtr<T>& b) { return a.ptr() == b.ptr(); }
};

View file

@ -165,7 +165,7 @@ private:
template<typename T>
struct Traits<OwnPtr<T>> : public GenericTraits<OwnPtr<T>> {
using PeekType = const T*;
static unsigned hash(const OwnPtr<T>& p) { return (unsigned)p.ptr(); }
static unsigned hash(const OwnPtr<T>& p) { return int_hash((u32)p.ptr()); }
static void dump(const OwnPtr<T>& p) { kprintf("%p", p.ptr()); }
static bool equals(const OwnPtr<T>& a, const OwnPtr<T>& b) { return a.ptr() == b.ptr(); }
};