File: hash.h

package info (click to toggle)
tarantool 1.5.2.20.g5f5d924-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,568 kB
  • ctags: 18,697
  • sloc: ansic: 109,092; sh: 21,312; cpp: 20,633; xml: 9,666; asm: 2,488; python: 2,195; java: 1,759; perl: 1,002; makefile: 679
file content (39 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (2)
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
#ifndef TC_HASH_H_INCLUDED
#define TC_HASH_H_INCLUDED

#if !MH_SOURCE
#define MH_UNDEF
#endif

#include <stdint.h>

#define mh_name _u32ptr
struct mh_u32ptr_node_t {
	uint32_t key;
	void *val;
};

#define mh_node_t struct mh_u32ptr_node_t
#define mh_arg_t void *
#define mh_hash(a, arg) (a->key)
#define mh_eq(a, b, arg) ((a->key) == (b->key))
#include <mhash.h>


struct ts_space;

uint32_t
search_hash(const struct ts_key *k, struct ts_space *s);

int
search_equal(const struct ts_key *a, const struct ts_key *b,
	     struct ts_space *s);

#define mh_name _pk
#define mh_node_t struct ts_key *
#define mh_arg_t struct ts_space *
#define mh_hash(a, arg) search_hash(*(a), arg)
#define mh_eq(a, b, arg) search_equal(*(a), *(b), arg)
#include <mhash.h>

#endif