16 #define RZ_RBTREE_MAX_HEIGHT 62
85 #define rz_rbtree_iter_get(it, struc, rb) (container_of((it)->path[(it)->len - 1], struc, rb))
87 #define rz_rbtree_iter_has(it) ((it)->len)
94 #define rz_rbtree_iter_while(it, data, struc, rb) \
95 for (; rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_next(&(it)))
98 #define rz_rbtree_iter_while_prev(it, data, struc, rb) \
99 for (; rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_prev(&(it)))
101 #define rz_rbtree_foreach(root, it, data, struc, rb) \
102 for ((it) = rz_rbtree_first(root); rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_next(&(it)))
104 #define rz_rbtree_foreach_prev(root, it, data, struc, rb) \
105 for ((it) = rz_rbtree_last(root); rz_rbtree_iter_has(&it) && (data = rz_rbtree_iter_get(&it, struc, rb)); rz_rbtree_iter_prev(&(it)))
113 #define rz_rbtree_cont_foreach(tree, it, dat) \
114 for ((it) = rz_rbtree_first((tree)->root ? &(tree)->root->node : NULL); rz_rbtree_iter_has(&it) && (dat = rz_rbtree_iter_get(&it, RContRBNode, node)->data); rz_rbtree_iter_next(&(it)))
116 #define rz_rbtree_cont_foreach_prev(tree, it, dat) \
117 for ((it) = rz_rbtree_last((tree)->root ? &(tree)->root->node : NULL); rz_rbtree_iter_has(&it) && (dat = rz_rbtree_iter_get(&it, RContRBNode, node)->data); rz_rbtree_iter_prev(&(it)))
static RzILOpEffect * cmp(cs_insn *insn, bool is_thumb)
const lzma_allocator const uint8_t * in
static void freefn(HtName_(Ht) *ht, HT_(Kv) *kv)
RZ_API RZ_OWN RContRBTree * rz_rbtree_cont_newf(RContRBFree f)
RZ_API bool rz_rbtree_cont_delete(RContRBTree *tree, void *data, RContRBCmp cmp, void *user)
RZ_API void rz_rbtree_cont_free(RContRBTree *tree)
RZ_API RBNode * rz_rbtree_find(RBNode *root, void *data, RBComparator cmp, void *user)
RZ_API void rz_rbtree_free(RZ_NULLABLE RBNode *root, RBNodeFree freefn, void *user)
RZ_API RBIter rz_rbtree_last(RBNode *root)
RZ_API bool rz_rbtree_insert(RBNode **root, void *data, RBNode *node, RBComparator cmp, void *user)
Returns true if the node was inserted successfully.
struct rz_containing_rb_tree_t RContRBTree
void(* RContRBFree)(void *)
struct rz_rb_iter_t RBIter
void(* RBNodeFree)(RBNode *node, void *user)
RZ_API bool rz_rbtree_aug_update_sum(RBNode *root, void *data, RBNode *node, RBComparator cmp, void *cmp_user, RBNodeSum sum)
Returns true if the sum has been updated, false if node has not been found.
RZ_API bool rz_rbtree_delete(RBNode **root, void *data, RBComparator cmp, void *cmp_user, RBNodeFree freefn, void *free_user)
Returns true if a node with an equal key is deleted.
struct rz_rb_node_t RBNode
RZ_API bool rz_rbtree_cont_insert(RContRBTree *tree, void *data, RContRBCmp cmp, void *user)
RZ_API bool rz_rbtree_aug_delete(RBNode **root, void *data, RBComparator cmp, void *cmp_user, RBNodeFree freefn, void *free_user, RBNodeSum sum)
Returns true if a node with an equal key is deleted.
void(* RBNodeSum)(RBNode *node)
RZ_API RBIter rz_rbtree_first(RBNode *root)
struct rz_containing_rb_node_t RContRBNode
RZ_API RBIter rz_rbtree_lower_bound_forward(RBNode *root, void *data, RBComparator cmp, void *user)
RZ_API void * rz_rbtree_cont_find(RContRBTree *tree, void *data, RContRBCmp cmp, void *user)
RZ_API RZ_OWN RContRBTree * rz_rbtree_cont_new(void)
RZ_API void rz_rbtree_iter_next(RBIter *it)
RZ_API void rz_rbtree_iter_prev(RBIter *it)
#define RZ_RBTREE_MAX_HEIGHT
RZ_API RBNode * rz_rbtree_lower_bound(RBNode *root, void *data, RBComparator cmp, void *user)
RZ_API bool rz_rbtree_aug_insert(RBNode **root, void *data, RBNode *node, RBComparator cmp, void *cmp_user, RBNodeSum sum)
Returns true if the node was inserted successfully.
int(* RContRBCmp)(void *incoming, void *in, void *user)
RZ_API RBNode * rz_rbtree_upper_bound(RBNode *root, void *data, RBComparator cmp, void *user)
int(* RBComparator)(const void *incoming, const RBNode *in_tree, void *user)
RZ_API RBIter rz_rbtree_upper_bound_backward(RBNode *root, void *data, RBComparator cmp, void *user)
RBNode * path[RZ_RBTREE_MAX_HEIGHT]
struct rz_rb_node_t * child[2]