hash.h
Exposes hash functions for standard data types.
- Author: Edward Jones
- Date: 2021-09-17
HASH_SIG
Hash a string.
- Param
v
: A value to hash
Returns: The hash of v
HASH_SIG(str);
HASH_SIG
Hash a size_t.
- Param
v
: A value to hash
Returns: The hash of v
HASH_SIG(size_t);
HASH_SIG
Hash a void pointer. This operates on the numerical value of the pointer, and not its content!
- Param
v
: A value to hash
Returns: The hash of v
HASH_SIG(ptr);
HASH_SIG
Hash an int.
- Param
v
: A value to hash
Returns: The hash of v
HASH_SIG(int);
HASH_SIG
Signature of a hashing function.
- Param
name
: The name of the type to hash
Returns: A signature for a function which hashes name
s
#define HASH_SIG(name) Hash hash_##name(void* v)
HASH_SIG
Hash a character.
- Param
v
: A value to hash
Returns: The hash of v
HASH_SIG(char);
Hasher
Type of a function which takes an object and returns its hash.
- Param
v
: A value to hash
Returns: The hash of v
typedef Hash (*Hasher)(void* v);