MCPcopy Create free account
hub / github.com/coreutils/coreutils / heapify_up

Function heapify_up

gl/lib/heap.c:136–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134/* Move element up into appropriate position in heap. */
135
136static void
137heapify_up (void **array, idx_t count,
138 int (*compare) (void const *, void const *))
139{
140 idx_t k = count;
141 void *new_element = array[k];
142
143 while (k != 1 && compare (array[k >> 1], new_element) <= 0)
144 {
145 array[k] = array[k >> 1];
146 k >>= 1;
147 }
148
149 array[k] = new_element;
150}

Callers 1

heap_insertFunction · 0.85

Calls 1

compareFunction · 0.85

Tested by

no test coverage detected