def checksum.crc.loop
import gralha-bytes@0.1.0.1/bytes.bend as Bytesimport 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))))