Accessors
This commit is contained in:
parent
0f75e40676
commit
e984c00379
17
treetrie.h
17
treetrie.h
|
@ -118,6 +118,23 @@ static inline tt_node_ptr_t tt_cons_node(tt_arena_t *a,
|
||||||
return tt_arena_cons(a, TT_TAG_NODE, index, zero, one);
|
return tt_arena_cons(a, TT_TAG_NODE, index, zero, one);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline tt_node_ptr_t tt_left(tt_arena_t *a, tt_node_ptr_t p) {
|
||||||
|
return a->nodes[tt_ptr_idx(p)].a;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline tt_node_ptr_t tt_right(tt_arena_t *a, tt_node_ptr_t p) {
|
||||||
|
return a->nodes[tt_ptr_idx(p)].b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TT_TAIL_TRIE(a,p) tt_left(a,p)
|
||||||
|
#define TT_BRANCH_WILDCARD(a,p) tt_left(a,p)
|
||||||
|
#define TT_BRANCH_OTHERS(a,p) tt_right(a,p)
|
||||||
|
#define TT_LEAF_TRIE(a,p) tt_left(a,p)
|
||||||
|
#define TT_LEAF_ATOM(a,p) ((tt_atom_t) tt_right(a,p))
|
||||||
|
#define TT_NODE_INDEX(a,p) (a->headers[tt_ptr_idx(p)].inuse.index)
|
||||||
|
#define TT_NODE_ZERO(a,p) tt_left(a,p)
|
||||||
|
#define TT_NODE_ONE(a,p) tt_right(a,p)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue