Flip key and element so types match, not that it matters for any code
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 4 Jan 2008 18:58:36 +0000 (18:58 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 4 Jan 2008 18:58:36 +0000 (18:58 +0000)
using it in libav*.

Originally committed as revision 11404 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/tree.c

index cc36676..b821802 100644 (file)
@@ -32,10 +32,10 @@ const int av_tree_node_size = sizeof(AVTreeNode);
 
 void *av_tree_find(const AVTreeNode *t, void *key, int (*cmp)(void *key, const void *b), void *next[2]){
     if(t){
-        unsigned int v= cmp(t->elem, key);
+        unsigned int v= cmp(key, t->elem);
         if(v){
-            if(next) next[(v>>31)^1]= t->elem;
-            return av_tree_find(t->child[v>>31], key, cmp, next);
+            if(next) next[v>>31]= t->elem;
+            return av_tree_find(t->child[(v>>31)^1], key, cmp, next);
         }else{
             if(next){
                 av_tree_find(t->child[0], key, cmp, next);