blob: 78dc2f95f926cdcc709add26fee83b478261c3c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/* ISC license. */
#include <skalibs/avlnode.h>
#include "avlnode-internal.h"
uint32_t avlnode_rotate (avlnode *s, uint32_t max, uint32_t i, int h)
{
uint32_t j = s[i].child[!h] ;
s[i].child[!h] = s[j].child[h] ;
s[j].child[h] = i ;
if (s[j].balance * avlnode_sfromu(h) < 0) s[i].balance = s[j].balance = 0 ;
else s[j].balance = avlnode_sfromu(h) ;
(void)max ;
return j ;
}
|