diff options
Diffstat (limited to 'include/tt_treap.c')
| -rw-r--r-- | include/tt_treap.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/include/tt_treap.c b/include/tt_treap.c index b48ffd4..369d767 100644 --- a/include/tt_treap.c +++ b/include/tt_treap.c @@ -12,10 +12,14 @@ static tt_entry_t * root; // =================================================================== void recurse_tree(tt_entry_t *n); -tt_entry_t *new_treap_node(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value); void bubble_up(tt_entry_t *n); +tt_entry_t * +new_treap_node(const uint64_t key, const enum TT_FLAG flag, + const uint8_t depth, const float value, + const action_t action); + + // =================================================================== // Exported functions // =================================================================== @@ -43,8 +47,9 @@ tt_entry_t *tt_seek(const uint64_t key) { } int tt_insert(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value) { - tt_entry_t *m = new_treap_node(key, flag, depth, value); + const uint8_t depth, const float value, + const action_t action) { + tt_entry_t *m = new_treap_node(key, flag, depth, value, action); if (root == NULL) { root = m; tt_num_cached = 1; @@ -78,8 +83,10 @@ void recurse_tree(tt_entry_t *n) { free(n); } -tt_entry_t *new_treap_node(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value) { +tt_entry_t * +new_treap_node(const uint64_t key, const enum TT_FLAG flag, + const uint8_t depth, const float value, + const action_t action) { tt_entry_t *n = malloc(sizeof(struct treap_node_s)); // TODO: trap n->key = key; @@ -89,6 +96,7 @@ tt_entry_t *new_treap_node(const uint64_t key, const enum TT_FLAG flag, n->left = NULL; n->right = NULL; n->parent = NULL; + n->action = action; XORSHIFT64; n->weight = RANDOM32; return n; } |
