234 while (node_off != 0)
255 node_off = parent_off;
273 if (left_off < heap->bh_size &&
280 if (right_off < heap->bh_size &&
290 swap_off = right_off;
static void swap_nodes(binaryheap *heap, int a, int b)
#define binaryheap_empty(h)
void binaryheap_replace_first(binaryheap *heap, Datum d)
void binaryheap_add_unordered(binaryheap *heap, Datum d)
void pfree(void *pointer)
static int compare(const void *arg1, const void *arg2)
static int parent_offset(int i)
Datum binaryheap_first(binaryheap *heap)
binaryheap_comparator bh_compare
static void sift_down(binaryheap *heap, int node_off)
void binaryheap_add(binaryheap *heap, Datum d)
static int right_offset(int i)
void binaryheap_reset(binaryheap *heap)
int(* binaryheap_comparator)(Datum a, Datum b, void *arg)
void binaryheap_build(binaryheap *heap)
#define Assert(condition)
static void sift_up(binaryheap *heap, int node_off)
void binaryheap_free(binaryheap *heap)
binaryheap * binaryheap_allocate(int capacity, binaryheap_comparator compare, void *arg)
Datum bh_nodes[FLEXIBLE_ARRAY_MEMBER]
Datum binaryheap_remove_first(binaryheap *heap)
bool bh_has_heap_property
static int left_offset(int i)
#define offsetof(type, field)
static int cmp(const chr *x, const chr *y, size_t len)