heap invariant INSIST did the wrong thing in the border case

of a heap item and its parent having identical priority
This commit is contained in:
Andreas Gustafsson 2000-05-22 19:47:01 +00:00
parent 5d1bfe4ce1
commit 34b26adb24

View file

@ -48,12 +48,12 @@
/*
* When the heap is in a consistent state, the following invariant
* holds true: for every element i > 1, heap_parent(i) has a higher
* priority than i.
* holds true: for every element i > 1, heap_parent(i) has a priority
* higher than or equal to that of i.
*/
#define HEAPCONDITION(i) ((i) == 1 || \
heap->compare(heap->array[heap_parent(i)], \
heap->array[(i)]))
! heap->compare(heap->array[(i)], \
heap->array[heap_parent(i)]))
struct isc_heap {
unsigned int magic;