Fix set & map (extra) find

This commit is contained in:
Gregory Lirent 2022-06-10 21:22:52 +03:00
parent 902e1cb86c
commit d0a89044f5
2 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callb
while (!mnode_is_empty(c)) {
key = vnode_peek(&c->key, x->type);
cmp = vtype_compare(key, x->type, k, t);
cmp = vtype_compare(k, t, key, x->type);
if (cmp == 0) {
cmp = (callback) ? callback(key, x->type, vnode_peek(&c->value, c->type), c->type, _) : 0;
@ -72,7 +72,7 @@ int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callb
}
return cmp;
}
} else c = (cmp < 0) ? c->left : c->right;
}
return -1;

View File

@ -51,7 +51,7 @@ int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access
while (!rbnode_is_empty(c)) {
val = vnode_peek(&c->value, x->type);
cmp = vtype_compare(val, x->type, v, t);
cmp = vtype_compare(v, t, val, x->type);
if (cmp == 0) {
cmp = (callback) ? callback(val, x->type, _) : 0;
@ -63,7 +63,7 @@ int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access
}
return cmp;
}
} else c = (cmp < 0) ? c->left : c->right;
}
return -1;