def digit_on
import bend-collections-laws-math@1.0.0.0/spec/math/fixed.bend as Fixedimport Base
import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as C
229# the value of exactly k base-256 digits, least significant first; None
230# for another length or a digit of 256 or more
231def digit_on(r: Maybe<&2, Nat>, ok: Bool, +x: Nat) -> Maybe<&2, Nat>:
232 match r:
233 case Some{+v}:
234 match ok:
235 case True{}:
236 Some{Nat.add(x, C.shift(8n, v))}
237 case False{}:
238 None{}
239 case None{}:
240 None{}
Uses (5)
Used by (9)
- bend-collections-laws-math@1.0.0.0/spec/math/fixed:from_le
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/fixbytes:from4_ok
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/fixbytes:from8_ok
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/fixbytes:d32_some
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/fixbytes:d32_val
- …