31 #if FF_API_CONTEXT_SIZE
41 int (*
cmp)(
void *key,
const void *
b),
void *next[2])
44 unsigned int v =
cmp(key, t->
elem);
46 if (next) 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)) {
107 if (( *child )->state * 2 == -t->
state) {
108 *tp = (*child)->
child[i ^ 1];
111 *child = ( *tp )->
child[i ^ 1];
114 (*tp)->child[0]->state = -((*tp)->state > 0);
115 (*tp)->child[1]->state = (*tp)->state < 0;
119 *child = (*child)->
child[i ^ 1];
121 if ((*tp)->state) t->
state = 0;
123 (*tp)->state = -t->
state;
127 if (!(*tp)->state ^ !!*next)
152 int (*
cmp)(
void *opaque,
void *
elem),
153 int (*enu)(
void *opaque,
void *elem))
160 enu(opaque, t->
elem);
177 if (left>999 || right>999)
179 if (right - left != t->
state)
183 return FFMAX(left, right) + 1;
191 for (i = 0; i < depth * 4; i++)
av_log(
NULL, AV_LOG_ERROR,
" ");
194 print(t->
child[0], depth + 1);
195 print(t->
child[1], depth + 1);
200 static int cmp(
void *
a,
const void *
b)
214 for (i = 0; i < 10000; i++) {
216 if (
check(root) > 999) {
217 av_log(
NULL, AV_LOG_ERROR,
"FATAL error %d\n", i);
221 av_log(
NULL, AV_LOG_ERROR,
"inserting %4d\n", j);
229 av_log(
NULL, AV_LOG_ERROR,
"removing %4d\n", j);
233 av_log(
NULL, AV_LOG_ERROR,
"removal failure %d\n", i);