1 #ifndef _SPLAY_TREE_H_
2 #define _SPLAY_TREE_H_
3 #include "first.h"
4
5 typedef struct tree_node {
6 struct tree_node * left, * right;
7 int key;
8 void *data;
9 } splay_tree;
10
11
12 splay_tree * splaytree_splay (splay_tree *t, int key);
13 splay_tree * splaytree_insert(splay_tree *t, int key, void *data);
14 splay_tree * splaytree_delete(splay_tree *t, int key);
15
16
17 #include "algo_md.h"
18
19 __attribute_pure__
20 static inline int32_t splaytree_djbhash(const char *str, const uint32_t len);
splaytree_djbhash(const char * str,const uint32_t len)21 static inline int32_t splaytree_djbhash(const char *str, const uint32_t len)
22 {
23 /* strip highest bit of hash value for splaytree */
24 return (int32_t)(djbhash(str,len,DJBHASH_INIT) & ~(((uint32_t)1) << 31));
25 }
26
27
28 #endif
29