19#ifndef FENNEC_LANG_HASHING_H
20#define FENNEC_LANG_HASHING_H
32template<
typename Key>
struct hash;
38 constexpr size_t operator()(
uint64_t x)
const {
41 x *= 0xff51afd7ed558ccd;
43 x *= 0xc4ceb9fe1a85ec53;
50template<
typename IntT>
51 requires is_integral_v<IntT>
52struct hash<IntT> : hash<uint64_t> {
57template<
typename PtrT>
58struct hash<PtrT*> : hash<uintptr_t> {
59 constexpr size_t operator()(PtrT* ptr)
const {
60 return hash<uintptr_t>::operator()((uintptr_t)(
const void*)ptr);
66struct hash<float> : hash<uint32_t> {
67 constexpr size_t operator()(
float x)
const {
68 return hash<uint32_t>::operator()(bit_cast<uint32_t>(x));
73struct hash<double> : hash<uint64_t> {
74 constexpr size_t operator()(
double x)
const {
75 return hash<uint64_t>::operator()(bit_cast<uint64_t>(x));
85constexpr size_t pair_hash(
size_t x,
size_t y) {
87 return (x >= y ? (x * x) + x + y : (
y *
y) + x);
constexpr genType y()
Definition constants.h:672
Struct for hashing types, there is no default hashing function.
Definition hashing.h:32
::uint64_t uint64_t
Unsigned 64-bit integer.
Definition types.h:275