Tinyhash
This is a library containing multiple C implementations of hashmap.
Loading...
Searching...
No Matches
Macros | Functions
hash.c File Reference
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for hash.c:

Go to the source code of this file.

Macros

#define TH_HASH_INITIAL_VALUE   2166136261u
 Initial value for hash function.
 
#define TH_HASH_MUL_VALUE   16777619
 Multiplier for hash function.
 

Functions

uint32_t th_hash (uint8_t *bytes, size_t size)
 Compute an unsigned int from bytes.
 

Macro Definition Documentation

◆ TH_HASH_INITIAL_VALUE

#define TH_HASH_INITIAL_VALUE   2166136261u

Initial value for hash function.

Definition at line 8 of file hash.c.

Referenced by th_hash().

◆ TH_HASH_MUL_VALUE

#define TH_HASH_MUL_VALUE   16777619

Multiplier for hash function.

Definition at line 14 of file hash.c.

Referenced by th_hash().

Function Documentation

◆ th_hash()

uint32_t th_hash ( uint8_t * bytes,
size_t size )

Compute an unsigned int from bytes.

Parameters
bytes
size
Returns
uint32_t

Definition at line 16 of file hash.c.

References TH_HASH_INITIAL_VALUE, and TH_HASH_MUL_VALUE.

Referenced by th_key_create().

Here is the caller graph for this function: