def ck.sum.go

bend-osdev-acpi@0.1.1.0 · checksum.bend:7

import bend-osdev-acpi@0.1.1.0/checksum.bend as Checksum
import Base

7# the sum of the bytes, modulo 2^32 (tail-recursive)
8def ck.sum.go(xs: List<&2, U32>, acc: U32) -> U32:
9  match xs:
10    case Nil{}:
11      acc
12    case Con{h, t}:
13      ck.sum.go(t, U32.add(acc, U32.and(255, h)))

Uses (4)

Used by (1)