summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authordevashish <devashishjaiswal86@gmail.com>2020-11-29 14:16:37 +0530
committerAndreas Kling <kling@serenityos.org>2020-11-29 16:22:04 +0100
commit0b252c31b2a4f699f9f2f219d7bd6495833982ba (patch)
tree6fabacf0849def19b777676e76d701b98c3bdfb7 /AK
parentd4b2e8987501102f0e6f9a6b5790aa1dae609cb7 (diff)
downloadserenity-0b252c31b2a4f699f9f2f219d7bd6495833982ba.zip
AK: Add missing GenericTraits<u8>
This enables us to use keys of type u8 in HashMaps.
Diffstat (limited to 'AK')
-rw-r--r--AK/Traits.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/AK/Traits.h b/AK/Traits.h
index 9d04f1d367..e3b7c1ac66 100644
--- a/AK/Traits.h
+++ b/AK/Traits.h
@@ -55,6 +55,12 @@ struct Traits<unsigned> : public GenericTraits<unsigned> {
};
template<>
+struct Traits<u8> : public GenericTraits<u8> {
+ static constexpr bool is_trivial() { return true; }
+ static unsigned hash(u8 u) { return int_hash(u); }
+};
+
+template<>
struct Traits<u16> : public GenericTraits<u16> {
static constexpr bool is_trivial() { return true; }
static unsigned hash(u16 u) { return int_hash(u); }