def sums
bend-parallel@0.1.0.0 · sort.bend:132
import bend-parallel@0.1.0.0/sort.bend as Sort
import Base
132
133
134
135
136def sums(+d: Nat, +wr: Bool, +j: U32, +w: Nat, +k: U32, +o: U32, +step: U32, +nb: Nat, ft: Array<U32> & Array<U32>, fc: Array<U32> & Array<U32>, fo: Array<U32> & Array<U32>) -> Three:
137 match d:
138 case 0n:
139 (t, t2) = ft
140 (cs, cs2) = fc
141 (os, os2) = fo
142 three.rejoin(t2, cs2, os2, sum.go(U32.to_nat((U32.shln(1, w) - 1 : U32)), wr, U32.shln(j, w), k, o, step, nb, Three{t, cs, os}))
143 case 1n+p:
144 (t0, t1) = ft
145 (c0, c1) = fc
146 (o0, o1) = fo
147 +i = (j * 2 : U32)
148 l r = sums(p, wr, i, w, k, o, step, nb, Array.fork(U32, t0), Array.fork(U32, c0), Array.fork(U32, o0))
149 sums(p, wr, (i + 1 : U32), w, k, o, step, nb, Array.fork(U32, t1), Array.fork(U32, c1), Array.fork(U32, o1))
150 three.join(l, r)