def push_room

bend-collections@1.0.0.0 · src/containers/binary_heap.bend:218

import bend-collections@1.0.0.0/src/containers/binary_heap.bend as BinaryHeap
import Base

218def push_room(~A: Data, ~cmp: A -> A -> Cmp, size: Nat, +n: U32, +depth: Nat, +cap: U32, arr: Array<Maybe<&2, A>>, x: A, room: Bool) -> Heap<A>:
219  match room:
220    case True{}:
221      BH{1n+size, U32.inc(n), depth, cap, sift_up(~A, ~cmp, depth, n, x, arr)}
222    case False{}:
223      BH{1n+size, U32.inc(n), 1n+depth, U32.shl(cap), sift_up(~A, ~cmp, 1n+depth, n, x, grown(~A, depth, arr))}

Uses (11)

Used by (1)