def dfold

bend-kit-hash@0.3.0.2 · hash.bend:98

import bend-kit-hash@0.3.0.2/hash.bend as Hash
import Base

98# Folds f over n 64-bit lanes from word i on. r holds the array and the lane at i.
99def dfold(~T: Type, ~f: T -> @+m: W64 -> T, n: Nat, r: Array<U32> & W64, +i: U32, acc: T) -> Array<U32> & T:
100  match n:
101    case 0n:
102      (a, m) = r
103      (a, acc)
104    case 1n+p:
105      (a, +m) = r
106      +j = (i + 2 : U32)
107      dfold(~T, ~f, p, get2(a, j), j, f(acc, m))

Uses (8)

Used by (1)