AK: Make Traits<T*> use ptr_hash() and not assume 32-bit pointers
As a nice bonus, it also simplifies the code quite a bit.
This commit is contained in:
parent
ad328f852b
commit
8776f424ac
Notes:
sideshowbarker
2024-07-18 09:09:47 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/8776f424ac8 Pull-request: https://github.com/SerenityOS/serenity/pull/8695
1 changed files with 2 additions and 6 deletions
|
@ -36,13 +36,9 @@ requires(IsIntegral<T>) struct Traits<T> : public GenericTraits<T> {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct Traits<T*> : public GenericTraits<T*> {
|
||||
static unsigned hash(const T* p)
|
||||
{
|
||||
return int_hash((unsigned)(__PTRDIFF_TYPE__)p);
|
||||
}
|
||||
requires(IsPointer<T>) struct Traits<T> : public GenericTraits<T> {
|
||||
static unsigned hash(T p) { return ptr_hash((FlatPtr)p); }
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static bool equals(const T* a, const T* b) { return a == b; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue