mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
AK: Add hash implementations for i16 and i64
This commit is contained in:
parent
3d02597316
commit
fb9a71bd6a
24
AK/Traits.h
24
AK/Traits.h
|
@ -48,6 +48,24 @@ struct Traits<int> : public GenericTraits<int> {
|
|||
static unsigned hash(int i) { return int_hash(i); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Traits<char> : public GenericTraits<char> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static unsigned hash(char c) { return int_hash(c); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Traits<i16> : public GenericTraits<i16> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static unsigned hash(i16 i) { return int_hash(i); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Traits<i64> : public GenericTraits<i64> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static unsigned hash(i64 i) { return u64_hash(i); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Traits<unsigned> : public GenericTraits<unsigned> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
|
@ -72,12 +90,6 @@ struct Traits<u64> : public GenericTraits<u64> {
|
|||
static unsigned hash(u64 u) { return u64_hash(u); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Traits<char> : public GenericTraits<char> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static unsigned hash(char c) { return int_hash(c); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Traits<T*> : public GenericTraits<T*> {
|
||||
static unsigned hash(const T* p)
|
||||
|
|
Loading…
Reference in a new issue