MCPcopy Create free account
hub / github.com/microsoft/SandDance / siftup

Function siftup

docs/app/js/sanddance-app.js:108691–108703  ·  view source on GitHub ↗
(array, idx, cmp)

Source from the content-addressed store, hash-verified

108689 return array[idx] = item;
108690}
108691function siftup(array, idx, cmp) {
108692 const start = idx, end = array.length, item = array[idx];
108693 let cidx = (idx << 1) + 1, ridx;
108694 while(cidx < end){
108695 ridx = cidx + 1;
108696 if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) cidx = ridx;
108697 array[idx] = array[cidx];
108698 idx = cidx;
108699 cidx = (idx << 1) + 1;
108700 }
108701 array[idx] = item;
108702 return siftdown(array, start, idx, cmp);
108703}
108704/**
108705 * A dataflow graph for reactive processing of data streams.
108706 * @constructor

Callers 1

HeapFunction · 0.70

Calls 1

siftdownFunction · 0.70

Tested by

no test coverage detected