summaryrefslogtreecommitdiff
path: root/src/libdatastruct/avlnode_extreme.c
blob: ab08d36cb5055da9259214263aa3a7df12a60fa4 (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, uint32_t max, uint32_t r, int h, uint32_t *k)
{
  uint32_t i = avlnode_extremenode(s, max, r, h) ;
  if (i >= max) return (errno = ESRCH, 0) ;
  *k = s[i].data ;
  return 1 ;
}