diff options
| author | gingerBill <bill@gingerbill.org> | 2019-08-29 14:36:42 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-08-29 14:36:42 +0100 |
| commit | c89fc35e941275085332ba16b453432b5b7a5086 (patch) | |
| tree | 6da1a49448aeb7d6751d41aa2ce6e19a1f6a4e6e /src/priority_queue.cpp | |
| parent | 614d209824f005aa11a399bbe1bbf2b3b9e76687 (diff) | |
Fix global variable initialization ordering
(related to #427)
Diffstat (limited to 'src/priority_queue.cpp')
| -rw-r--r-- | src/priority_queue.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/priority_queue.cpp b/src/priority_queue.cpp index 7c36e6a22..aee2061b5 100644 --- a/src/priority_queue.cpp +++ b/src/priority_queue.cpp @@ -20,7 +20,7 @@ bool priority_queue_shift_down(PriorityQueue<T> *pq, isize i0, isize n) { if (j2 < n && pq->cmp(&pq->queue[0], j2, j1) < 0) { j = j2; } - if (pq->cmp(&pq->queue[0], i, j) < 0) break; + if (pq->cmp(&pq->queue[0], j, i) >= 0) break; pq->swap(&pq->queue[0], i, j); i = j; @@ -32,7 +32,7 @@ template <typename T> void priority_queue_shift_up(PriorityQueue<T> *pq, isize j) { while (0 <= j && j < pq->queue.count) { isize i = (j-1)/2; - if (i == j || pq->cmp(&pq->queue[0], i, j) < 0) { + if (i == j || pq->cmp(&pq->queue[0], j, i) >= 0) { break; } pq->swap(&pq->queue[0], i, j); |