DWFCore::tDWFDJB2HashKernel< S > Struct Template Reference

#include "dwfcore/Hash.h"

Inheritance diagram for DWFCore::tDWFDJB2HashKernel< S >:

Inheritance graph
[legend]
Collaboration diagram for DWFCore::tDWFDJB2HashKernel< S >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class S>
struct DWFCore::tDWFDJB2HashKernel< S >

32-bit DJB2 hash function.

Since:
1.0.1
This algorithm (k=33) was first reported by D.J. Bernstein many years ago in comp.lang.c. Another version of this algorithm (now favored by Bernstein) uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; the magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.
Parameters:
S The content type of the hash

Definition at line 84 of file Hash.h.

Public Member Functions

uint32_t operator() (S *_s, uint32_t _seed=5381) const


Member Function Documentation

template<class S>
uint32_t DWFCore::tDWFDJB2HashKernel< S >::operator() S *  _s,
uint32_t  _seed = 5381
const [inline]
 

32-bit hash function for S type content.

Parameters:
_s The content to hash.
_seed The initial hash value.
Returns:
The hash code.

Definition at line 93 of file Hash.h.


The documentation for this struct was generated from the following file:
Generated on Tue Jan 6 22:39:37 2009 for Autodesk DWF Core Library by  doxygen 1.4.5