KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
hash_fnv1a.h
Go to the documentation of this file.
1#ifndef KIDS_HASH_FNV1A_H
2#define KIDS_HASH_FNV1A_H
3
4#include <cstdint>
5
6namespace utils {
7
8constexpr uint32_t fnv1a(const char* str, uint32_t hash = 2166136261u) {
9 return (*str == '\0') ? hash : fnv1a(str + 1, (hash ^ static_cast<uint32_t>(*str)) * 16777619u);
10}
11
12constexpr uint32_t hash(const char* str) { return fnv1a(str); }
13
14}; // namespace utils
15
16
17#endif // KIDS_HASH_FNV1A_H
Definition concat.h:18
constexpr uint32_t hash(const char *str)
Definition hash_fnv1a.h:12
constexpr uint32_t fnv1a(const char *str, uint32_t hash=2166136261u)
Definition hash_fnv1a.h:8