def rmf_links

bend-collections@1.0.0.0 · src/containers/internal/dlist_storage.bend:401

import bend-collections@1.0.0.0/src/containers/internal/dlist_storage.bend as DlistStorage
import Base

401# Unlink the element at slot i and push i on the free stack. `set_next` writes
402# at the NEIGHBOUR slots (both different from i), so the last write, which
403# stores the old top in nexts[i], cannot be overwritten.
404def rmf_links(~T: Data, +tag: U32, +fresh: U32, +free: U32, count: Nat, +head: U32, +tail: U32, +depth: Nat, +cap: U32, vals: Array<Maybe<&2, T>>, +i: U32, v: T, pr: Array<U32> & U32, nx: Array<U32> & U32) -> DList<T> & Maybe<&2, T>:
405  (prevs, +p) = pr
406  (nexts, +n) = nx
407  (DL{tag, fresh, link(i), Nat.sub(count, 1n), pick_end(U32.is_eq(p, nil()), n, head), pick_end(U32.is_eq(n, nil()), p, tail), depth, cap,
408      vals, set_next(prevs, n, p), Array.set(U32, set_next(nexts, p, n), i, free)}, Some{v})

Uses (14)

Used by (1)