blob: 335025c01304fb855d4ca4dbf0a6bdd49e2763ee (
plain)
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>
unsigned int avltreen_newnode (avltreen_ref t, unsigned int d)
{
register unsigned int i = genset_new(&t->x) ;
if (i < avltreen_totalsize(t))
{
register avlnode_ref 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 ;
}
|