[priority-queue] More assert adjustment
This commit is contained in:
parent
620ddd762d
commit
02949cf64f
|
@ -63,6 +63,8 @@ struct hb_priority_queue_t
|
||||||
|
|
||||||
heap.arrayZ[0] = heap.arrayZ[heap.length - 1];
|
heap.arrayZ[0] = heap.arrayZ[heap.length - 1];
|
||||||
heap.shrink (heap.length - 1);
|
heap.shrink (heap.length - 1);
|
||||||
|
|
||||||
|
if (!is_empty ())
|
||||||
bubble_down (0);
|
bubble_down (0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -100,7 +102,7 @@ struct hb_priority_queue_t
|
||||||
|
|
||||||
void bubble_down (unsigned index)
|
void bubble_down (unsigned index)
|
||||||
{
|
{
|
||||||
assert (index <= heap.length);
|
assert (index < heap.length);
|
||||||
|
|
||||||
unsigned left = left_child (index);
|
unsigned left = left_child (index);
|
||||||
unsigned right = right_child (index);
|
unsigned right = right_child (index);
|
||||||
|
|
Loading…
Reference in New Issue