libclod
C library for interacting with NBTs, region files, LOD data and other things.
Loading...
Searching...
No Matches
clod_table_opts Struct Reference

#include <table.h>

Public Attributes

size_t min_capacity
uint64_t(* hash_func )(uint64_t seed, const void *key, size_t key_size, void *user)
int(* cmp_func )(const void *key1, size_t key1_size, const void *key2, size_t key2_size, void *user)
void *(* malloc_func )(size_t, void *user)
void(* free_func )(void *, void *user)
void * user

Detailed Description

Configuration options passed to clod_table_create. Zero values imply defaults.

Definition at line 34 of file table.h.

Member Data Documentation

◆ min_capacity

size_t clod_table_opts::min_capacity

Minimum number of elements to support without further allocation. The table will never shrink to a capacity below this.

Definition at line 37 of file table.h.

◆ hash_func

uint64_t(* clod_table_opts::hash_func) (uint64_t seed, const void *key, size_t key_size, void *user)

Custom hash function. Defaults to clod_sip64. This map implementation demands a uniform spread of entropy across all bits in uint64, and that two keys with nonequal hashes are also not equal when using the cmp_func method.

Definition at line 41 of file table.h.

◆ cmp_func

int(* clod_table_opts::cmp_func) (const void *key1, size_t key1_size, const void *key2, size_t key2_size, void *user)

Custom equality function. Defaults to memcmp. The required behaviour for the hash_func and cmp_func relationship is; assert(cmp_func(a, b) != 0 || hash_func(a) == hash_func(b)); In other words, if cmp_func thinks two elements are equal, hash_func must agree.

Definition at line 46 of file table.h.

◆ malloc_func

void *(* clod_table_opts::malloc_func) (size_t, void *user)

Custom memory allocation function.

Definition at line 48 of file table.h.

◆ free_func

void(* clod_table_opts::free_func) (void *, void *user)

Custom memory freeing function.

Definition at line 50 of file table.h.

◆ user

void* clod_table_opts::user

Value passed to callbacks.

Definition at line 52 of file table.h.


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