avlnode_searchnode.c (364B)
1 /* ISC license. */ 2 3 #include <skalibs/avlnode.h> 4 #include "avlnode-internal.h" 5 6 uint32_t avlnode_searchnode (avlnode const *s, uint32_t max, uint32_t r, void const *k, dtok_func_ref dtok, cmp_func_ref f, void *p) 7 { 8 while (r < max) 9 { 10 int h = (*f)(k, (*dtok)(s[r].data, p), p) ; 11 if (!h) break ; 12 r = s[r].child[avlnode_ufroms(h)] ; 13 } 14 return r ; 15 }