Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
hash.cpp
Go to the documentation of this file.
1#include "thorin/util/hash.h"
2
3namespace thorin {
4
5hash_t hash(const char* s) {
7 for (const char* p = s; *p != '\0'; ++p) seed = thorin::hash_combine(seed, *p);
8 return seed;
9}
10
11hash_t hash(std::string_view s) {
12 hash_t seed = thorin::hash_begin(s.size());
13 for (auto c : s) seed = thorin::hash_combine(seed, c);
14 return seed;
15}
16
17} // namespace thorin
Definition cfg.h:11
hash_t hash_begin()
Definition hash.h:103
hash_t hash_combine(hash_t seed, T v)
Returns a new hash by combining the hash seed with val.
Definition hash.h:83
uint32_t hash_t
Definition hash.h:9
hash_t hash(const char *)
Definition hash.cpp:5