blob: bbfb639d30f08dbaab597c6ee4ce5d2eeac0c15a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* ISC license. */
#include <skalibs/genset.h>
#include <skalibs/avlnode.h>
#include <skalibs/avltreen.h>
uint32_t avltreen_newnode (avltreen *t, uint32_t d)
{
uint32_t i = genset_new(&t->x) ;
if (i < avltreen_totalsize(t))
{
avlnode *s = avltreen_nodes(t) ;
s[i].data = d ;
s[i].child[0] = s[i].child[1] = avltreen_totalsize(t) ;
s[i].balance = 0 ;
}
return i ;
}
|