def puts

bend-parallel@0.1.0.0 · scan.bend:146

import bend-parallel@0.1.0.0/scan.bend as Scan
import Base

146# Pass 3's forks, shaped as pass 1's. Leaf i reads s[i] and reads and
147# writes only its block of a: no two lanes touch one slot.
148def puts(+inc: Bool, +d: Nat, +i: U32, +e: Nat, fa: Array<U32> & Array<U32>, fs: Array<U32> & Array<U32>) -> Two:
149  match d:
150    case 0n:
151      (a, a2) = fa
152      (s, s2) = fs
153      two.rejoin(a2, s2, puts.leaf(inc, i, e, a, s))
154    case 1n+p:
155      (a0, a1) = fa
156      (s0, s1) = fs
157      +j = (i * 2 : U32)
158      l r = puts(inc, p, j, e, Array.fork(U32, a0), Array.fork(U32, s0))
159        puts(inc, p, (j + 1 : U32), e, Array.fork(U32, a1), Array.fork(U32, s1))
160      two.join(l, r)

Uses (13)

Used by (1)