blob: 98ec09994a01e7386a0308751d3f46672162dd61 (
plain)
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
|
#ifndef _SPLAY_TREE_H_
#define _SPLAY_TREE_H_
#include "first.h"
typedef struct tree_node {
struct tree_node * left, * right;
int key;
void *data;
} splay_tree;
splay_tree * splaytree_splay (splay_tree *t, int key);
splay_tree * splaytree_insert(splay_tree *t, int key, void *data);
splay_tree * splaytree_delete(splay_tree *t, int key);
#include "algo_md.h"
__attribute_pure__
static inline int32_t splaytree_djbhash(const char *str, const uint32_t len);
static inline int32_t splaytree_djbhash(const char *str, const uint32_t len)
{
/* strip highest bit of hash value for splaytree */
return (int32_t)(djbhash(str,len,DJBHASH_INIT) & ~(((uint32_t)1) << 31));
}
#endif
|