39 static const uint_type offsetBasis = 2166136261U;
40 static const uint_type prime = 16777619U;
51 static const uint_type offsetBasis = 14695981039346656037ULL;
52 static const uint_type prime = 1099511628211ULL;
61 template<
unsigned SIZE = sizeof(std::
size_t)*8>
64 static_assert(SIZE == 32 || SIZE == 64,
"Bit size must be 32 or 64");
70 typedef typename traits_t::uint_type uint_type;
73 template<
typename BYTE>
74 uint_type operator()(
const BYTE* byteSeq, std::size_t len)
const
76 auto hash = traits_t::offsetBasis;
77 for (std::size_t i = 0; i < len; ++i)
78 hashStep(hash, *(byteSeq + i));
83 template<
typename BYTE>
84 uint_type operator()(
const BYTE* byteSeq)
const
86 auto hash = traits_t::offsetBasis;
87 for (; *byteSeq != 0; ++byteSeq)
88 hashStep(hash, *byteSeq);
93 template<
typename ITERATOR>
94 uint_type operator()(ITERATOR begin, ITERATOR end)
const
96 auto hash = traits_t::offsetBasis;
97 for (; begin != end; ++begin)
98 hashStep(hash, *begin);
103 template<
typename BYTE>
104 static inline void hashStep(uint_type& hash, BYTE byte)
106 static_assert(
sizeof(BYTE) == 1,
"valid BYTE type");
107 hash ^=
static_cast<uint_type
>(byte);
108 hash *= traits_t::prime;
std::uint32_t uint_type
Definition: hash_fnv.h:38
Definition: basic_shared_pointer.h:20
Definition: hash_fnv.h:28
hash_fnv_1a< 64 > hash64_fnv_1a
Definition: hash_fnv.h:113
hash_fnv_1a< 32 > hash32_fnv_1a
Definition: hash_fnv.h:112
std::uint64_t uint_type
Definition: hash_fnv.h:50
Definition: hash_fnv.h:62