Skip to content

Commit

Permalink
Sophie nits
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Aug 8, 2019
1 parent 220ba25 commit f2318c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/scheduler/src/SchedulerMinHeap.js
Expand Up @@ -28,7 +28,7 @@ export function pop(heap: Heap): Node | null {
const first = heap[0];
if (first !== undefined) {
const last = heap.pop();
if (last !== undefined && last !== first) {
if (last !== first) {
heap[0] = last;
siftDown(heap, last, 0);
}
Expand All @@ -39,8 +39,8 @@ export function pop(heap: Heap): Node | null {
}

function siftUp(heap, node, index) {
while (index > 0) {
const parentIndex = Math.floor((index + 1) / 2) - 1;
while (true) {
const parentIndex = Math.floor((index - 1) / 2);
const parent = heap[parentIndex];
if (parent !== undefined && compare(parent, node) > 0) {
// The parent is larger. Swap positions.
Expand Down

0 comments on commit f2318c1

Please sign in to comment.