[Glacier] Move hashmap to a real hash implementation.
This commit is contained in:
parent
76fd3fc176
commit
28d9e37b87
4 changed files with 60 additions and 26 deletions
27
lib/glacier/util/hash.h
Normal file
27
lib/glacier/util/hash.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace glcr {
|
||||
|
||||
// General purpose templated hash function.
|
||||
// Currently the template speciializations
|
||||
// implement FNV hashing:
|
||||
// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
||||
template <typename T>
|
||||
struct Hash {
|
||||
uint64_t operator()(const T&);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Hash<uint64_t> {
|
||||
uint64_t operator()(const uint64_t&);
|
||||
};
|
||||
|
||||
class String;
|
||||
template <>
|
||||
struct Hash<String> {
|
||||
uint64_t operator()(const String&);
|
||||
};
|
||||
|
||||
} // namespace glcr
|
||||
Loading…
Add table
Add a link
Reference in a new issue