40 int (*
cmp)(
const void *key,
const void *
b),
void *next[2])
43 unsigned int v =
cmp(key, t->
elem);
46 next[v >> 31] = t->
elem;
64 unsigned int v =
cmp(t->
elem, key);
73 key = t->
elem = next_elem[i];
83 int i = (v >> 31) ^ !!*next;
85 t->
state += 2 * i - 1;
87 if (!(t->
state & 1)) {
109 if ((*child)->state * 2 == -t->
state) {
110 *tp = (*child)->
child[i ^ 1];
113 *child = (*tp)->
child[i ^ 1];
114 (*tp)->
child[i ^ 1] = t;
117 (*tp)->child[1]->state = (*tp)->state < 0;
121 *child = (*child)->
child[i ^ 1];
122 (*tp)->
child[i ^ 1] = t;
127 (*tp)->state = -t->
state;
131 if (!(*tp)->state ^ !!*next)
156 int (*
cmp)(
void *opaque,
void *
elem),
157 int (*enu)(
void *opaque,
void *elem))
164 enu(opaque, t->
elem);
Memory handling functions.
void * av_tree_find(const AVTreeNode *t, void *key, int(*cmp)(const void *key, const void *b), void *next[2])
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
struct AVTreeNode * av_tree_node_alloc(void)
Allocate an AVTreeNode.
AVS_FilterInfo AVS_Value child
void av_tree_destroy(AVTreeNode *t)
struct AVTreeNode * child[2]
static int cmp(const void *a, const void *b)
const int av_tree_node_size
void * av_tree_insert(AVTreeNode **tp, void *key, int(*cmp)(const void *key, const void *b), AVTreeNode **next)
Insert or remove an element.
void av_tree_enumerate(AVTreeNode *t, void *opaque, int(*cmp)(void *opaque, void *elem), int(*enu)(void *opaque, void *elem))
Apply enu(opaque, &elem) to all the elements in the tree in a given range.