GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
fnv1a.hpp
Go to the documentation of this file.
1// This file is distributed under the BSD License.
2// See "license.txt" for details.
3// Copyright 2009-2012, Jonathan Turner (jonathan@emptycrate.com)
4// Copyright 2009-2017, Jason Turner (jason@emptycrate.com)
5// http://www.chaiscript.com
6
7#ifndef CHAISCRIPT_UTILITY_FNV1A_HPP_
8#define CHAISCRIPT_UTILITY_FNV1A_HPP_
9
10
11#include <cstdint>
13
14
15namespace chaiscript
16{
17
18
19 namespace utility
20 {
21
22
23 static constexpr std::uint32_t fnv1a_32(const char *s, std::uint32_t h = 0x811c9dc5) {
24#ifdef __GNUC__
25#pragma GCC diagnostic push
26#pragma GCC diagnostic ignored "-Wsign-conversion"
27#endif
28
29#ifdef CHAISCRIPT_MSVC
30#pragma warning(push)
31#pragma warning(disable : 4307)
32#endif
33 return (*s == 0) ? h : fnv1a_32(s+1, ((h ^ (*s)) * 0x01000193));
34#ifdef CHAISCRIPT_MSVC
35#pragma warning(pop)
36#endif
37
38#ifdef __GNUC__
39#pragma GCC diagnostic pop
40#endif
41
42 }
43
44
45 }
46
47
48}
49
50#endif
Definition fnv1a.hpp:20
Namespace chaiscript contains every API call that the average user will be concerned with.