Go to the documentation of this file.
54 static inline unsigned int Bits() {
return 32;}
61 static inline unsigned int Bits() {
return 30;}
68 static inline unsigned int Bits() {
return 64;}
73 template <
class HashParams>
77 inline FNVHash(
typename HashParams::HashType in_uBase = HashParams::s_offsetBasis );
82 inline typename HashParams::HashType
Compute(
const void* in_pData,
typename HashParams::SizeType in_dataSize );
83 inline typename HashParams::HashType
Get()
const {
return m_uHash; }
86 inline typename HashParams::HashType
Compute(
const T& in_pData) {
return Compute(&in_pData,
sizeof(T)); }
88 static inline typename HashParams::HashType
ComputeLowerCase(
const char* in_pData);
91 typename HashParams::HashType m_uHash;
96 #pragma warning(disable:4127)
99 template <
class HashParams>
101 : m_uHash( in_uBase )
105 template <
class HashParams>
108 const unsigned char* pData = (
const unsigned char*) in_pData;
109 const unsigned char* pEnd = pData + in_dataSize;
111 typename HashParams::HashType hval = m_uHash;
114 while( pData < pEnd )
116 hval *= HashParams::Prime();
123 if( HashParams::Bits() >=
sizeof(
typename HashParams::HashType) * 8 )
126 typename HashParams::HashType mask =
static_cast<typename HashParams::HashType
>(((
typename HashParams::HashType)1 << HashParams::Bits())-1);
127 return (
typename HashParams::HashType)(hval >> HashParams::Bits()) ^ (hval & mask);
130 template <
class HashParams>
133 typename HashParams::HashType hval = HashParams::s_offsetBasis;
136 while (*in_pData != 0)
138 hval *= HashParams::Prime();
139 unsigned char c = (
unsigned char)*in_pData++;
140 c = (c >=
'A' && c <=
'Z') ? c -
'A' +
'a' : c;
145 if (HashParams::Bits() >=
sizeof(
typename HashParams::HashType) * 8)
148 typename HashParams::HashType mask =
static_cast<typename HashParams::HashType
>(((
typename HashParams::HashType)1 << HashParams::Bits()) - 1);
149 return (
typename HashParams::HashType)(hval >> HashParams::Bits()) ^ (hval & mask);
152 #if defined(_MSC_VER)
FNVHash< Hash32 > FNVHash32
static unsigned int Bits()
static unsigned int Bits()
static const HashType s_offsetBasis
FNVHash(typename HashParams::HashType in_uBase=HashParams::s_offsetBasis)
Constructor.
static const HashType s_offsetBasis
HashParams::HashType Compute(const T &in_pData)
static unsigned int Bits()
FNVHash< Hash64 > FNVHash64
FNVHash< Hash30 > FNVHash30
HashParams::HashType Compute(const void *in_pData, typename HashParams::SizeType in_dataSize)
static HashParams::HashType ComputeLowerCase(const char *in_pData)
HashParams::HashType Get() const
Tell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise