/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
1
/*
2
*/
3
4
#ifndef __H_HASH__
5
#define __H_HASH__
6
7
#include "defs.h"
22 by Gustav Hartvigsson
* Made code compile
8
#include "utils.h"
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
9
10
BEGIN_DECLS
11
12
/** @file
13
 * A collection of hash functions.
14
 */
15
53 by Gustav Hartvigsson
* Finnished up s_map_add () ???
16
/**
17
 * A HashFunc is the type of function to use when you need to hash some
18
 * type of object.
19
 */
20
typedef hash_t (* HashFunc)(const spointer);
21
22
/**
23
 * Convinience macro to cast function.
24
 */
25
#define HASH_FUNC(f) (HashFunc)(f)
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
26
27
/**
28
 * this is the SDBM hash function from:
29
 * http://en.literateprograms.org/Hash_function_comparison_%28C,_sh%29
30
 */
53 by Gustav Hartvigsson
* Finnished up s_map_add () ???
31
hash_t sdbm_hash (const char * key);
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
32
53 by Gustav Hartvigsson
* Finnished up s_map_add () ???
33
hash_t s_hash_object (const spointer obj);
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
34
29 by Gustav Hartvigsson
* Switched to CMake to future proof the project a lil' bit.
35
/* TODO: Make this settable via CMake. */
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
36
/**
37
 * what hash function s_hash is defined to.
38
 */
39
#define s_hash(k) sdbm_hash(k)
40
41
42
END_DECLS
43
44
#endif