MCPcopy Index your code
hub / github.com/git/git / sift_down_root

Function sift_down_root

prio-queue.c:61–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61static void sift_down_root(struct prio_queue *queue)
62{
63 size_t ix, child;
64
65 /* Push down the one at the root */
66 for (ix = 0; ix * 2 + 1 < queue->nr; ix = child) {
67 child = ix * 2 + 1; /* left */
68 if (child + 1 < queue->nr &&
69 compare(queue, child, child + 1) >= 0)
70 child++; /* use right child */
71
72 if (compare(queue, ix, child) <= 0)
73 break;
74
75 swap(queue, child, ix);
76 }
77}
78
79void *prio_queue_get(struct prio_queue *queue)
80{

Callers 2

prio_queue_getFunction · 0.85
prio_queue_replaceFunction · 0.85

Calls 2

swapFunction · 0.85
compareFunction · 0.70

Tested by

no test coverage detected