Euphoria
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libs
core
src
core
hash.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <string_view>
4
5
#include "
base/ints.h
"
6
7
namespace
eu::core
8
{
9
// implements fnv-1a: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
10
11
constexpr
U64
hash64
(
const
std::string_view str,
U64
hash = 0xcbf29ce484222325)
12
{
13
return
str.empty() ?
hash
:
hash64
(str.substr(1), (
hash
^ str[0]) * 0x100000001b3);
14
}
15
}
ints.h
eu::core
Definition:
argparse.cc:45
eu::core::Key::hash
@ hash
eu::core::hash64
constexpr U64 hash64(const std::string_view str, U64 hash=0xcbf29ce484222325)
Definition:
hash.h:11
eu::U64
std::uint64_t U64
Definition:
ints.h:12