123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <common/glib.h>
- struct bt_node_t
- {
- struct bt_node_t *left;
- struct bt_node_t *right;
- struct bt_node_t *parent;
- void *value;
- } __attribute__((aligned(sizeof(long))));
- struct bt_root_t
- {
- struct bt_node_t *bt_node;
- int (*cmp)(struct bt_node_t *a, struct bt_node_t *b);
-
- int (*release)(void *value);
- };
- struct bt_root_t *bt_create_tree(struct bt_node_t *node, int (*cmp)(struct bt_node_t *a, struct bt_node_t *b));
- struct bt_node_t *bt_create_node(struct bt_node_t *left, struct bt_node_t *right, struct bt_node_t *parent, void *value);
- int bt_insert(struct bt_root_t *root, void *value);
- int bt_query(struct bt_root_t *root, void *value, uint64_t *ret_addr);
|