2018-10-10 05:53:07 -04:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-27 03:33:24 -04:00
|
|
|
#include "HashFunctions.h"
|
2019-05-28 05:53:16 -04:00
|
|
|
#include "kstdio.h"
|
2018-10-10 05:53:07 -04:00
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
template<typename T>
|
2019-05-28 05:53:16 -04:00
|
|
|
struct Traits {
|
2018-10-10 05:53:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct Traits<int> {
|
2019-01-31 11:31:23 -05:00
|
|
|
static unsigned hash(int i) { return int_hash(i); }
|
2018-10-17 04:55:43 -04:00
|
|
|
static void dump(int i) { kprintf("%d", i); }
|
2018-10-10 05:53:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct Traits<unsigned> {
|
2019-01-31 11:31:23 -05:00
|
|
|
static unsigned hash(unsigned u) { return int_hash(u); }
|
2018-10-17 04:55:43 -04:00
|
|
|
static void dump(unsigned u) { kprintf("%u", u); }
|
2018-10-10 05:53:07 -04:00
|
|
|
};
|
|
|
|
|
2019-03-13 11:05:56 -04:00
|
|
|
template<>
|
|
|
|
struct Traits<word> {
|
|
|
|
static unsigned hash(unsigned u) { return int_hash(u); }
|
|
|
|
static void dump(unsigned u) { kprintf("%u", u); }
|
|
|
|
};
|
|
|
|
|
2018-10-11 10:52:30 -04:00
|
|
|
template<typename T>
|
|
|
|
struct Traits<T*> {
|
2018-10-27 03:33:24 -04:00
|
|
|
static unsigned hash(const T* p)
|
|
|
|
{
|
2019-01-31 11:31:23 -05:00
|
|
|
return int_hash((dword)p);
|
2018-10-27 03:33:24 -04:00
|
|
|
}
|
2018-10-17 04:55:43 -04:00
|
|
|
static void dump(const T* p) { kprintf("%p", p); }
|
2018-10-11 10:52:30 -04:00
|
|
|
};
|
|
|
|
|
2018-10-10 05:53:07 -04:00
|
|
|
}
|