def checksum.crc.loop

gralha-bytes@0.1.0.1 · bytes.bend:386

import gralha-bytes@0.1.0.1/bytes.bend as Bytes
import Base

386def checksum.crc.loop(n: Nat, +src: Bytes, +index: U32, +table: Bytes, +crc: U32) -> U32:
387  match n:
388    case 0n: U32.xor(crc, 4294967295)
389    case 1n+d: checksum.crc.loop(d, src, U32.inc(index), table, U32.xor(U32.shrn(crc, 8n), bytes.get(table, U32.and(U32.xor(crc, bytes.get(src, index)), 255))))

Uses (8)

Used by (2)