39 int (*
cmp)(
void *key,
const void *
b),
void *next[2])
42 unsigned int v =
cmp(key, t->
elem);
44 if (next) next[v >> 31] = t->
elem;
62 unsigned int v =
cmp(t->
elem, key);
71 key = t->
elem = next_elem[i];
81 int i = (v >> 31) ^ !!*next;
83 t->
state += 2 * i - 1;
85 if (!(t->
state & 1)) {
105 if (( *child )->state * 2 == -t->
state) {
106 *tp = (*child)->
child[i ^ 1];
109 *child = ( *tp )->
child[i ^ 1];
112 (*tp)->child[0]->state = -((*tp)->state > 0);
113 (*tp)->child[1]->state = (*tp)->state < 0;
117 *child = (*child)->
child[i ^ 1];
119 if ((*tp)->state) t->
state = 0;
121 (*tp)->state = -t->
state;
125 if (!(*tp)->state ^ !!*next)
150 int (*
cmp)(
void *opaque,
void *
elem),
151 int (*enu)(
void *opaque,
void *elem))
158 enu(opaque, t->
elem);
175 if (left>999 || right>999)
177 if (right - left != t->
state)
181 return FFMAX(left, right) + 1;
192 print(t->
child[0], depth + 1);
193 print(t->
child[1], depth + 1);
198 static int cmp(
void *
a,
const void *
b)
212 for (i = 0; i < 10000; i++) {
214 if (
check(root) > 999) {