def put.if

bend-kit-bytes@0.3.3.0 · bytes.bend:211

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

211# Little-endian writes forward from i; big-endian writes back from the last byte.
212def put.if(ok: Bool, +len: U32, buf: Array<U32>, +i: U32, +n: U32, +be: Bool, +v: U32) -> Bytes:
213  match ok:
214    case True{}:
215      Bytes{len, put.go(U32.to_nat(n), buf, Bool.pick(U32, be, (i + n - 1 : U32), i), Bool.not(be), v)}
216    case False{}:
217      Bytes{len, buf}

Uses (10)

Used by (1)