Mercurial > libavutil.hg
comparison tree.c @ 418:9f2461caf179 libavutil
Flip key and element so types match, not that it matters for any code
using it in libav*.
author | michael |
---|---|
date | Fri, 04 Jan 2008 18:58:36 +0000 |
parents | 1f1ebfcfa9cd |
children | 290f5853797a |
comparison
equal
deleted
inserted
replaced
417:ba2d05538ec1 | 418:9f2461caf179 |
---|---|
30 | 30 |
31 const int av_tree_node_size = sizeof(AVTreeNode); | 31 const int av_tree_node_size = sizeof(AVTreeNode); |
32 | 32 |
33 void *av_tree_find(const AVTreeNode *t, void *key, int (*cmp)(void *key, const void *b), void *next[2]){ | 33 void *av_tree_find(const AVTreeNode *t, void *key, int (*cmp)(void *key, const void *b), void *next[2]){ |
34 if(t){ | 34 if(t){ |
35 unsigned int v= cmp(t->elem, key); | 35 unsigned int v= cmp(key, t->elem); |
36 if(v){ | 36 if(v){ |
37 if(next) next[(v>>31)^1]= t->elem; | 37 if(next) next[v>>31]= t->elem; |
38 return av_tree_find(t->child[v>>31], key, cmp, next); | 38 return av_tree_find(t->child[(v>>31)^1], key, cmp, next); |
39 }else{ | 39 }else{ |
40 if(next){ | 40 if(next){ |
41 av_tree_find(t->child[0], key, cmp, next); | 41 av_tree_find(t->child[0], key, cmp, next); |
42 av_tree_find(t->child[1], key, cmp, next); | 42 av_tree_find(t->child[1], key, cmp, next); |
43 } | 43 } |