MimIR
0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
hash.cpp
Go to the documentation of this file.
1
#include "
mim/util/hash.h
"
2
3
namespace
mim
{
4
5
hash_t
hash
(
const
char
* s) {
6
hash_t
seed =
mim::hash_begin
();
7
for
(
const
char
* p = s; *p !=
'\0'
; ++p) seed =
mim::hash_combine
(seed, *p);
8
return
seed;
9
}
10
11
hash_t
hash
(std::string_view s) {
12
hash_t
seed =
mim::hash_begin
(s.size());
13
for
(
auto
c : s) seed =
mim::hash_combine
(seed, c);
14
return
seed;
15
}
16
17
}
// namespace mim
hash.h
mim
Definition
cfg.h:11
mim::hash_combine
hash_t hash_combine(hash_t seed, T v)
Returns a new hash by combining the hash seed with val.
Definition
hash.h:82
mim::hash_begin
hash_t hash_begin()
Definition
hash.h:102
mim::hash_t
uint32_t hash_t
Definition
hash.h:9
mim::hash
hash_t hash(const char *)
Definition
hash.cpp:5
src
mim
util
hash.cpp
Generated by
1.12.0