51 static inline unsigned int Bits() {
return 32;}
58 static inline unsigned int Bits() {
return 30;}
64 static inline unsigned int Bits() {
return 64;}
69 template <
class HashParams>
73 inline FNVHash(
typename HashParams::HashType in_uBase = HashParams::s_offsetBasis );
78 inline typename HashParams::HashType
Compute(
const void* in_pData,
unsigned int in_dataSize );
79 inline typename HashParams::HashType
Get()
const {
return m_uHash; }
82 inline typename HashParams::HashType
Compute(
const T& in_pData) {
return Compute(&in_pData,
sizeof(T)); }
85 typename HashParams::HashType m_uHash;
90 #pragma warning(disable:4127)
94 template <
class HashParams>
101 template <
class HashParams>
104 const unsigned char* pData = (
const unsigned char*) in_pData;
105 const unsigned char* pEnd = pData + in_dataSize;
107 typename HashParams::HashType hval = m_uHash;
110 while( pData < pEnd )
112 hval *= HashParams::Prime();
119 if( HashParams::Bits() >=
sizeof(
typename HashParams::HashType) * 8 )
122 typename HashParams::HashType mask = static_cast<typename HashParams::HashType>(((
typename HashParams::HashType)1 << HashParams::Bits())-1);
123 return (
typename HashParams::HashType)(hval >> HashParams::Bits()) ^ (hval & mask);
126 #if defined(_MSC_VER)
static const HashType s_offsetBasis
FNVHash< Hash32 > FNVHash32
HashParams::HashType Compute(const void *in_pData, unsigned int in_dataSize)
static const HashType s_offsetBasis
FNVHash< Hash64 > FNVHash64
FNVHash< Hash30 > FNVHash30
unsigned long long HashType
static unsigned int Bits()
static unsigned int Bits()
HashParams::HashType Compute(const T &in_pData)
FNVHash(typename HashParams::HashType in_uBase=HashParams::s_offsetBasis)
Constructor.
HashParams::HashType Get() const
static unsigned int Bits()