Go to the documentation of this file.
53 static inline unsigned int Bits() {
return 32;}
60 static inline unsigned int Bits() {
return 30;}
67 static inline unsigned int Bits() {
return 64;}
72 template <
class HashParams>
76 inline FNVHash(
typename HashParams::HashType in_uBase = HashParams::s_offsetBasis );
81 inline typename HashParams::HashType
Compute(
const void* in_pData,
typename HashParams::SizeType in_dataSize );
82 inline typename HashParams::HashType
Get()
const {
return m_uHash; }
85 inline typename HashParams::HashType
Compute(
const T& in_pData) {
return Compute(&in_pData,
sizeof(T)); }
87 static inline typename HashParams::HashType
ComputeLowerCase(
const char* in_pData);
90 typename HashParams::HashType m_uHash;
95 #pragma warning(disable:4127)
98 template <
class HashParams>
100 : m_uHash( in_uBase )
104 template <
class HashParams>
107 const unsigned char* pData = (
const unsigned char*) in_pData;
108 const unsigned char* pEnd = pData + in_dataSize;
110 typename HashParams::HashType hval = m_uHash;
113 while( pData < pEnd )
115 hval *= HashParams::Prime();
122 if( HashParams::Bits() >=
sizeof(
typename HashParams::HashType) * 8 )
125 typename HashParams::HashType mask =
static_cast<typename HashParams::HashType
>(((
typename HashParams::HashType)1 << HashParams::Bits())-1);
126 return (
typename HashParams::HashType)(hval >> HashParams::Bits()) ^ (hval & mask);
129 template <
class HashParams>
132 typename HashParams::HashType hval = HashParams::s_offsetBasis;
135 while (*in_pData != 0)
137 hval *= HashParams::Prime();
138 unsigned char c = (
unsigned char)*in_pData++;
139 c = (c >=
'A' && c <=
'Z') ? c -
'A' +
'a' : c;
144 if (HashParams::Bits() >=
sizeof(
typename HashParams::HashType) * 8)
147 typename HashParams::HashType mask =
static_cast<typename HashParams::HashType
>(((
typename HashParams::HashType)1 << HashParams::Bits()) - 1);
148 return (
typename HashParams::HashType)(hval >> HashParams::Bits()) ^ (hval & mask);
151 #if defined(_MSC_VER)
FNVHash< Hash32 > FNVHash32
Definition of data structures for AkAudioObject.
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
uint64_t AkUInt64
Unsigned 64-bit integer.
uint32_t AkUInt32
Unsigned 32-bit integer.
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