blob: 75eea7a96145506e418f10711104f4961e26550f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <cstddef>
#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
|