1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*
*/
#pragma once
#include "defs.h"
#include "utils.h"
S_BEGIN_DECLS
/** @file
* A collection of hash functions.
*/
/**
* A HashFunc is the type of function to use when you need to hash some
* type of object.
*/
typedef hash_t (* HashFunc)(const spointer);
/**
* Convinience macro to cast function.
*/
#define HASH_FUNC(f) (HashFunc)(f)
/**
* this is the SDBM hash function from:
* http://en.literateprograms.org/Hash_function_comparison_%28C,_sh%29
*/
S_EXPORTED
hash_t
sdbm_hash (const char * key);
S_EXPORTED
hash_t
s_hash_object (const spointer obj);
/* TODO: Make this settable via CMake. */
/**
* what hash function s_hash is defined to.
*/
#define s_hash sdbm_hash
S_END_DECLS
|