diff options
author | Sahan Fernando <sahan.h.fernando@gmail.com> | 2020-12-14 10:53:47 +1100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-19 10:20:15 +0100 |
commit | fb9a71bd6a1e7dba39a894440ecfa540e10d604f (patch) | |
tree | 03c5360e12c9b20ddd1f66bd438f5989a7387c7f /AK/Traits.h | |
parent | 3d02597316f60fe017582ac32c19ff7844f92eb7 (diff) | |
download | serenity-fb9a71bd6a1e7dba39a894440ecfa540e10d604f.zip |
AK: Add hash implementations for i16 and i64
Diffstat (limited to 'AK/Traits.h')
-rw-r--r-- | AK/Traits.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/AK/Traits.h b/AK/Traits.h index e3b7c1ac66..281c174af1 100644 --- a/AK/Traits.h +++ b/AK/Traits.h @@ -49,6 +49,24 @@ struct Traits<int> : public GenericTraits<int> { }; 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; } static unsigned hash(unsigned u) { return int_hash(u); } @@ -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) |