summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
Diffstat (limited to 'AK')
-rw-r--r--AK/Traits.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/AK/Traits.h b/AK/Traits.h
index fc67ce4b9d..539174b7d0 100644
--- a/AK/Traits.h
+++ b/AK/Traits.h
@@ -40,6 +40,20 @@ requires(IsIntegral<T>) struct Traits<T> : public GenericTraits<T> {
}
};
+#ifndef KERNEL
+template<typename T>
+requires(IsFloatingPoint<T>) struct Traits<T> : public GenericTraits<T> {
+ static constexpr bool is_trivial() { return true; }
+ static constexpr unsigned hash(T value)
+ {
+ if constexpr (sizeof(T) < 8)
+ return int_hash(bit_cast<u32>(value));
+ else
+ return u64_hash(bit_cast<u64>(value));
+ }
+};
+#endif
+
template<typename T>
requires(IsPointer<T> && !Detail::IsPointerOfType<char, T>) struct Traits<T> : public GenericTraits<T> {
static unsigned hash(T p) { return ptr_hash((FlatPtr)p); }