summaryrefslogtreecommitdiffhomepage
path: root/attic/hash.hpp
blob: c915ce9538a7106dc4f4a2e26eea3ec16dcddf11 (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 floormat {

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 floormat