Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

bdlb::HashUtil Struct Reference

#include <bdlb_hashutil.h>

List of all members.

Static Public Member Functions

static unsigned int hash0 (char key, int modulus)
static unsigned int hash0 (signed char key, int modulus)
static unsigned int hash0 (unsigned char key, int modulus)
static unsigned int hash0 (short key, int modulus)
static unsigned int hash0 (unsigned short key, int modulus)
static unsigned int hash0 (int key, int modulus)
static unsigned int hash0 (unsigned int key, int modulus)
static unsigned int hash0 (long key, int modulus)
static unsigned int hash0 (unsigned long key, int modulus)
static unsigned int hash0 (bsls::Types::Int64 key, int modulus)
static unsigned int hash0 (bsls::Types::Uint64 key, int modulus)
static unsigned int hash0 (float key, int modulus)
static unsigned int hash0 (double key, int modulus)
static unsigned int hash0 (const void *key, int modulus)
static unsigned int hash0 (const char *string, int modulus)
static unsigned int hash0 (const char *string, int stringLength, int modulus)
static unsigned int hash1 (const char *data, int length)
static unsigned int hash2 (const char *data, int length)
static unsigned int hash1 (char key)
static unsigned int hash1 (signed char key)
static unsigned int hash1 (unsigned char key)
static unsigned int hash1 (short key)
static unsigned int hash1 (unsigned short key)
static unsigned int hash1 (int key)
static unsigned int hash1 (unsigned int key)
static unsigned int hash1 (long key)
static unsigned int hash1 (unsigned long key)
static unsigned int hash1 (bsls::Types::Int64 key)
static unsigned int hash1 (bsls::Types::Uint64 key)
static unsigned int hash1 (float key)
static unsigned int hash1 (double key)
static unsigned int hash1 (const void *key)
static unsigned int hash2 (char key)
static unsigned int hash2 (signed char key)
static unsigned int hash2 (unsigned char key)
static unsigned int hash2 (short key)
static unsigned int hash2 (unsigned short key)
static unsigned int hash2 (int key)
static unsigned int hash2 (unsigned int key)
static unsigned int hash2 (long key)
static unsigned int hash2 (unsigned long key)
static unsigned int hash2 (bsls::Types::Int64 key)
static unsigned int hash2 (bsls::Types::Uint64 key)
static unsigned int hash2 (float key)
static unsigned int hash2 (double key)
static unsigned int hash2 (const void *key)

Detailed Description

This struct provides a namespace for hash functions.

See Component bdlb_hashutil


Member Function Documentation

static unsigned int bdlb::HashUtil::hash0 ( char  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( signed char  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( unsigned char  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( short  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( unsigned short  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( int  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( unsigned int  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( long  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( unsigned long  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( bsls::Types::Int64  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( bsls::Types::Uint64  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( float  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( double  key,
int  modulus 
) [static]
static unsigned int bdlb::HashUtil::hash0 ( const void *  key,
int  modulus 
) [static]

Return an unsigned integer hash value in the range from zero to one less than the specified modulus corresponding to the specified key. The behavior is undefined unless 0 < modulus < 2^31. Note that modulus is expected to be a prime not close to an integral power of 2. Also note that specifying a modulus of 1 will cause 0 to be returned for every value.

static unsigned int bdlb::HashUtil::hash0 ( const char *  string,
int  modulus 
) [static]

Return a pseudo-random unsigned integer in the range from zero to one less than the specified modulus corresponding to the specified null-terminated string. The behavior is undefined unless 0 < modulus < 2^31. Note that modulus is expected to be a prime not close to an integral power of 2. Also note that specifying a modulus of 1 will cause 0 to be returned for every string.

static unsigned int bdlb::HashUtil::hash0 ( const char *  string,
int  stringLength,
int  modulus 
) [static]

Return a pseudo-random unsigned integer in the range from zero to one less than the specified modulus corresponding to the specified string having the specified stringLength. string need not be null-terminated and may contain embedded null characters. The behavior is undefined unless 0 <= stringLength and 0 < modulus < 2^31. Note that modulus is expected to be a prime not close to an integral power of 2. Also note that specifying a modulus of 1 will cause 0 to be returned for every string.

static unsigned int bdlb::HashUtil::hash1 ( const char *  data,
int  length 
) [static]
static unsigned int bdlb::HashUtil::hash2 ( const char *  data,
int  length 
) [static]

Return an unsigned integer hash value corresponding to the specified data of the specified length (in bytes). The behavior is undefined unless 0 <= length. Note that if data is 0, then length also must be 0. Also note that every byte in data is significant; that is, it is not appropriate to cast a struct address to a char * unless the struct is packed (no padding).

Both hash1 and hash2 return a hash, but both hashes can be assumed to be independent (i.e., there are no known correlations between the results of the two hash functions given the same input data).

static unsigned int bdlb::HashUtil::hash1 ( char  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( signed char  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( unsigned char  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( short  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( unsigned short  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( int  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( unsigned int  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( long  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( unsigned long  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( bsls::Types::Int64  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( bsls::Types::Uint64  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( float  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( double  key  )  [static]
static unsigned int bdlb::HashUtil::hash1 ( const void *  key  )  [static]

Return an unsigned integer hash value corresponding to the specified key. Note that the return value is seemingly random (i.e., the hash is good) but identical on all platforms (irrespective of endianness). Both functions hash1 and hash2 return a hash, but both hashes can be assumed to be independent (i.e., there are no known correlations between the results of both hash functions given the same input data).

static unsigned int bdlb::HashUtil::hash2 ( char  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( signed char  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( unsigned char  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( short  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( unsigned short  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( int  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( unsigned int  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( long  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( unsigned long  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( bsls::Types::Int64  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( bsls::Types::Uint64  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( float  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( double  key  )  [static]
static unsigned int bdlb::HashUtil::hash2 ( const void *  key  )  [static]

Return an unsigned integer hash value corresponding to the specified key. Note that the return value is seemingly random (i.e., the hash is good) but identical on all platforms (irrespective of endianness). Both functions hash1 and hash2 return a hash, but both hashes can be assumed to be independent (i.e., there are no known correlations between the results of both hash functions given the same input data).


The documentation for this struct was generated from the following file: