Veritable Lasagna
An Allocator & Data Structure Library for C.
Loading...
Searching...
No Matches
vl_hash.c File Reference
#include "vl_hash.h"
#include "vl_memory.h"
+ Include dependency graph for vl_hash.c:

Functions

vl_hash vlHashString (const void *data, vl_memsize_t dataSize)
 Hashes the specified string.
 
vl_hash vlHash8 (const void *data, vl_memsize_t s)
 Generates a hash code for the 8-bit sequence at the specified address.
 
vl_hash vlHash16 (const void *data, vl_memsize_t s)
 Generates a hash code for the 16-bit sequence at the specified address. This is a direct bitcast of an 8-bit sequence to a 64-bit sequence. The returned value will equal the value of the original sequence.
 
vl_hash vlHash32 (const void *data, vl_memsize_t s)
 Generates a hash code for the 32-bit sequence at the specified address.
 
vl_hash vlHash64 (const void *data, vl_memsize_t s)
 Generates a hash code for the 64-bit sequence at the specified address.
 

Function Documentation

◆ vlHash16()

vl_hash vlHash16 ( const void * data,
vl_memsize_t s )

Generates a hash code for the 16-bit sequence at the specified address. This is a direct bitcast of an 8-bit sequence to a 64-bit sequence. The returned value will equal the value of the original sequence.

Parameters
datapointer
Returns
hash code

◆ vlHash32()

vl_hash vlHash32 ( const void * data,
vl_memsize_t s )

Generates a hash code for the 32-bit sequence at the specified address.

This is a direct bitcast of an 32-bit sequence to a 64-bit sequence. The returned value will equal the value of the original sequence.

Parameters
datapointer
Returns
hash code

◆ vlHash64()

vl_hash vlHash64 ( const void * data,
vl_memsize_t s )

Generates a hash code for the 64-bit sequence at the specified address.

The returned value will equal the value of the original sequence.

Parameters
datapointer
Returns
hash code

◆ vlHash8()

vl_hash vlHash8 ( const void * data,
vl_memsize_t s )

Generates a hash code for the 8-bit sequence at the specified address.

This is a direct bitcast of an 8-bit sequence to a 64-bit sequence. The returned value will equal the value of the original sequence.

Parameters
datapointer
Returns
hash code

◆ vlHashString()

vl_hash vlHashString ( const void * data,
vl_memsize_t dataSize )

Hashes the specified string.

Uses the FNV-1A-64 string hashing algorithm. See here: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

Parameters
dataread-only pointer to the data that will be hashed
dataSizelength of the data, in bytes. Usually this can be ignored unless the data is variable in length.
Returns
corresponding hash code.
+ Here is the caller graph for this function: