1 #ifndef __LUNAIX_SPARSE_H
2 #define __LUNAIX_SPARSE_H
4 #include <lunaix/ds/llist.h>
5 #include <lunaix/types.h>
10 * key-sorted prefix tree
14 struct btrie_node* btrie_root;
20 struct llist_header nodes;
21 struct btrie_node* parent;
25 struct btrie_node** children;
30 btrie_init(struct btrie* btrie, unsigned int order);
33 btrie_get(struct btrie* root, unsigned long index);
36 * Set an object into btrie tree at given location,
37 * override if another object is already present.
40 btrie_set(struct btrie* root, unsigned long index, void* data);
43 * Map an object into btrie tree, return the index the object
47 btrie_map(struct btrie* root,
48 unsigned long start, unsigned long end, void* data);
51 btrie_remove(struct btrie* root, unsigned long index);
54 btrie_release(struct btrie* tree);
56 #endif /* __LUNAIX_SPARSE_H */