mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Use int_hash() to generate less idiotic hashes for {Nonnull,}OwnPtr
This commit is contained in:
parent
e0395d5ebe
commit
eaa9cf58f5
Notes:
sideshowbarker
2024-07-19 12:40:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/eaa9cf58f58
2 changed files with 2 additions and 2 deletions
|
@ -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(); }
|
||||
};
|
||||
|
|
|
@ -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(); }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue