MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / bubble_up

Function bubble_up

libCacheSim/dataStructure/pqueue.c:99–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98
99static void
100bubble_up(pqueue_t *q, size_t i)
101{
102 size_t parent_node;
103 void *moving_node = q->d[i];
104 pqueue_pri_t moving_pri = q->getpri(moving_node);
105
106 for (parent_node = parent(i);
107 ((i > 1) && q->cmppri(q->getpri(q->d[parent_node]), moving_pri));
108 i = parent_node, parent_node = parent(i))
109 {
110 q->d[i] = q->d[parent_node];
111 q->setpos(q->d[i], i);
112 }
113
114 q->d[i] = moving_node;
115 q->setpos(moving_node, i);
116}
117
118
119static size_t

Callers 3

pqueue_insertFunction · 0.85
pqueue_change_priorityFunction · 0.85
pqueue_removeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected