kzc_hash_code.hpp File Reference

General purpose hash code functions. More...

Macros

#define KZ_KNUTH_HASH_MUL
 Knuth's hash multiplier for 32-bit constants. More...
 
#define KZ_FNV1_HASH_SEED
 When defined, use Knuth's hash over FNV hash. More...
 
#define KZ_FNV1_HASH_PRIME
 FNV-1 hash prime. More...
 

Typedefs

typedef kzU32(* KzcHashFunction) (const void *object)
 Custom hash function definition. More...
 

Functions

KZ_INLINE kzU32 kzcHashCodeFromUint (kzUint value)
 Hash code function for unsigned integers. More...
 
KZ_INLINE kzU32 kzcHashCodeFromFloat (kzFloat value)
 Hash code function for floats. More...
 
KZ_INLINE kzU32 kzcHashCodeFromInt (kzInt value)
 Hash code function for signed integers. More...
 
KZ_INLINE kzU32 kzcHashCodeFromPointerUint (kzUint value)
 Hash code function for pointers that are already casted to uints. More...
 
KZ_INLINE kzU32 kzcHashCodeFromPointer (const void *value)
 Hash code function for pointers. More...
 
KZ_INLINE kzU32 kzcHashCodeFromString (kzString value)
 Hash code function for strings. More...
 

Detailed Description

General purpose hash code functions.

Hash code and comparator is related such that for two objects a and b if compare(a,b) == 0 then hashCode(a) == hashCode(b).

Copyright 2008-2017 by Rightware. All rights reserved.

Macro Definition Documentation

#define KZ_KNUTH_HASH_MUL

Knuth's hash multiplier for 32-bit constants.

#define KZ_FNV1_HASH_SEED

When defined, use Knuth's hash over FNV hash.

FNV-1 hash seed.

#define KZ_FNV1_HASH_PRIME

FNV-1 hash prime.

Typedef Documentation

typedef kzU32(* KzcHashFunction) (const void *object)

Custom hash function definition.

Function Documentation

KZ_INLINE kzU32 kzcHashCodeFromUint ( kzUint  value)

Hash code function for unsigned integers.

KZ_INLINE kzU32 kzcHashCodeFromFloat ( kzFloat  value)

Hash code function for floats.

KZ_INLINE kzU32 kzcHashCodeFromInt ( kzInt  value)

Hash code function for signed integers.

KZ_INLINE kzU32 kzcHashCodeFromPointerUint ( kzUint  value)

Hash code function for pointers that are already casted to uints.

KZ_INLINE kzU32 kzcHashCodeFromPointer ( const void *  value)

Hash code function for pointers.

KZ_INLINE kzU32 kzcHashCodeFromString ( kzString  value)

Hash code function for strings.