Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

HashUtility.cpp File Reference

Hash functions utilities. More...

#include <sstream>
#include <SimData/HashUtility.h>

Defines

#define mix(a, b, c)

Functions

uint32 newhash (register uint8 const *k, uint32 length, uint32 initval)
 A character string to 32-bit hash function.

uint32 newhash4_cstring (std::string const &str)
 Generate a 32-bit hash from a string.

HashT newhasht_cstring (std::string const &str)
 Generate a 64-bit hash (HashT) from a string.

std::ostream & operator<< (std::ostream &o, const hasht &x)


Detailed Description

Hash functions utilities.

The hash functions coded here are from "Hash Functions for Hash Table Lookup" by Robert J. Jenokins Jr., and are Public Domain. See <http://burtleburtle.net/bob/hash/evahash.html>


Define Documentation

#define mix a,
b,
 
 

Value:

{ \
  a=a-b;  a=a-c;  a=a^(c>>13); \
  b=b-c;  b=b-a;  b=b^(a<<8);  \
  c=c-a;  c=c-b;  c=c^(b>>13); \
  a=a-b;  a=a-c;  a=a^(c>>12); \
  b=b-c;  b=b-a;  b=b^(a<<16); \
  c=c-a;  c=c-b;  c=c^(b>>5);  \
  a=a-b;  a=a-c;  a=a^(c>>3);  \
  b=b-c;  b=b-a;  b=b^(a<<10); \
  c=c-a;  c=c-b;  c=c^(b>>15); \
}


Function Documentation

uint32 newhash register uint8 const *    k,
uint32    length,
uint32    initval
 

A character string to 32-bit hash function.

Author:
Bob Jenkins, December 1996, Public Domain.
Parameters:
k  the string to hash
length  the length of the string in bytes.
initval  the previous hash, or an arbitrary value

uint32 newhash4_cstring std::string const &    str
 

Generate a 32-bit hash from a string.

HashT newhasht_cstring std::string const &    str
 

Generate a 64-bit hash (HashT) from a string.

std::ostream& operator<< std::ostream &    o,
const hasht   x
 


SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:39 2003, using Doxygen 1.2.18.

[SF.net]