mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
AK: Add ptr_hash to use int_hash or u64_hash depending on pointer size
This commit is contained in:
parent
32e6453b0b
commit
7e6ac544f7
Notes:
sideshowbarker
2024-07-19 09:04:20 +09:00
Author: https://github.com/jcs
Commit: 7e6ac544f7
Pull-request: https://github.com/SerenityOS/serenity/pull/1233
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bugaevc
3 changed files with 10 additions and 2 deletions
|
@ -204,7 +204,7 @@ inline void swap(OwnPtr<T>& a, OwnPtr<U>& b)
|
|||
template<typename T>
|
||||
struct Traits<OwnPtr<T>> : public GenericTraits<OwnPtr<T>> {
|
||||
using PeekType = const T*;
|
||||
static unsigned hash(const OwnPtr<T>& p) { return int_hash((u32)p.ptr()); }
|
||||
static unsigned hash(const OwnPtr<T>& p) { return ptr_hash(p.ptr()); }
|
||||
static bool equals(const OwnPtr<T>& a, const OwnPtr<T>& b) { return a.ptr() == b.ptr(); }
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue