mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add ptr_hash to use int_hash or u64_hash depending on pointer size
This commit is contained in:
committed by
Andreas Kling
parent
32e6453b0b
commit
7e6ac544f7
@@ -50,3 +50,11 @@ inline unsigned u64_hash(u64 key)
|
||||
u32 last = key >> 32;
|
||||
return pair_int_hash(first, last);
|
||||
}
|
||||
|
||||
inline unsigned ptr_hash(uintptr_t ptr)
|
||||
{
|
||||
if constexpr(sizeof(ptr) == 8)
|
||||
return u64_hash((u64)ptr);
|
||||
else
|
||||
return int_hash((u32)ptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user