mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
AK: Add hash implementations for i16 and i64
This commit is contained in:
parent
3d02597316
commit
fb9a71bd6a
Notes:
sideshowbarker
2024-07-19 00:44:59 +09:00
Author: https://github.com/ccapitalK Commit: https://github.com/SerenityOS/serenity/commit/fb9a71bd6a1 Pull-request: https://github.com/SerenityOS/serenity/pull/4458
1 changed files with 18 additions and 6 deletions
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…
Add table
Reference in a new issue