[priority-queue] Fix asserts

This commit is contained in:
Behdad Esfahbod 2022-11-16 12:04:35 -07:00
parent 57de568aad
commit 620ddd762d
1 changed files with 3 additions and 3 deletions

View File

@ -128,7 +128,7 @@ struct hb_priority_queue_t
void bubble_up (unsigned index) void bubble_up (unsigned index)
{ {
assert (index <= heap.length); assert (index < heap.length);
if (index == 0) return; if (index == 0) return;
@ -142,8 +142,8 @@ struct hb_priority_queue_t
void swap (unsigned a, unsigned b) void swap (unsigned a, unsigned b)
{ {
assert (a <= heap.length); assert (a < heap.length);
assert (b <= heap.length); assert (b < heap.length);
hb_swap (heap.arrayZ[a], heap.arrayZ[b]); hb_swap (heap.arrayZ[a], heap.arrayZ[b]);
} }
}; };