mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
e6284a8774
The SpinLock was all backwards and didn't actually work. Fixing it exposed how wrong most of the locking here is. I need to come up with a better granularity here.
39 lines
692 B
C++
39 lines
692 B
C++
#pragma once
|
|
|
|
#include "kstdio.h"
|
|
#include "HashFunctions.h"
|
|
|
|
namespace AK {
|
|
|
|
template<typename T>
|
|
struct Traits
|
|
{
|
|
};
|
|
|
|
template<>
|
|
struct Traits<int> {
|
|
static unsigned hash(int i) { return intHash(i); }
|
|
static void dump(int i) { kprintf("%d", i); }
|
|
};
|
|
|
|
template<>
|
|
struct Traits<unsigned> {
|
|
static unsigned hash(unsigned u) { return intHash(u); }
|
|
static void dump(unsigned u) { kprintf("%u", u); }
|
|
};
|
|
|
|
template<typename T>
|
|
struct Traits<T*> {
|
|
static unsigned hash(const T* p)
|
|
{
|
|
#ifdef SERENITY
|
|
return intHash((dword)p);
|
|
#else
|
|
return intHash((unsigned long long)p & 0xffffffff);
|
|
#endif
|
|
}
|
|
static void dump(const T* p) { kprintf("%p", p); }
|
|
};
|
|
|
|
}
|
|
|