summaryrefslogtreecommitdiffhomepage
path: root/hash.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-02-21 14:29:22 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-02-21 14:29:22 +0100
commit5eb4ae08d5cd81f7315998394054aa50e52b6870 (patch)
tree1174490ccb5cbcb4167d715a30d385e796beb25d /hash.hpp
parentb8aa39d289c605b13bb550b786cba3f646fa5b48 (diff)
buffer flush
Diffstat (limited to 'hash.hpp')
-rw-r--r--hash.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/hash.hpp b/hash.hpp
new file mode 100644
index 00000000..c6d74444
--- /dev/null
+++ b/hash.hpp
@@ -0,0 +1,24 @@
+#pragma once
+#include <cstdint>
+
+namespace Magnum::Examples {
+
+template<unsigned N = sizeof(std::size_t)*8> struct hash;
+
+template<>
+struct hash<32> final {
+ [[maybe_unused]]
+ constexpr std::uint32_t operator()(std::uint32_t x) const noexcept {
+ return (std::uint32_t)x*0x9e3779b1u;
+ }
+};
+
+template<>
+struct hash<64> final {
+ [[maybe_unused]]
+ constexpr std::uint64_t operator()(std::uint64_t x) const noexcept {
+ return x*0x9e3779b97f4a7c15ull;
+ }
+};
+
+} // namespace Magnum::Examples