summaryrefslogtreecommitdiff
path: root/src/libdatastruct/avlnode_extreme.c
blob: 42d991d38eeb55d9ef17feb390f6a51b2ef2c078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <errno.h>
#include <skalibs/avlnode.h>

int avlnode_extreme (avlnode const *s, unsigned int max, unsigned int r, int h, unsigned int *k)
{
  register unsigned int i = avlnode_extremenode(s, max, r, h) ;
  if (i >= max) return (errno = ESRCH, 0) ;
  *k = s[i].data ;
  return 1 ;
}