- heap->data[index*2] = heap->data[heap->data_used*2];
- heap->data[index*2+1] = heap->data[heap->data_used*2+1];
- /* heapify down if index has children */
- if (heap->data_used >= 2*index+1) heap_heapify_down(heap, index);
- if ((index > 0) && (index < heap->data_used)) heap_heapify_up(heap, index);
+ heap->data[idx*2] = heap->data[heap->data_used*2];
+ heap->data[idx*2+1] = heap->data[heap->data_used*2+1];
+ /* heapify down if idx has children */
+ if (heap->data_used >= 2*idx+1) heap_heapify_down(heap, idx);
+ if ((idx > 0) && (idx < heap->data_used)) heap_heapify_up(heap, idx);