blob: 36b1ab645d39b332757e5a0881db3749d270c8fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/* ISC license. */
#include <stdint.h>
#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 ;
}
|