| 108689 | return array[idx] = item; |
| 108690 | } |
| 108691 | function 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 |