Checksum.AcpiChecksum.byte_for: def of bend-osdev-acpi@0.1.1.0 Import: import bend-osdev-acpi@0.1.1.0/checksum.bend as Checksum Lines 23-27 of bend-osdev-acpi@0.1.1.0/checksum.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-acpi@0.1.1.0/checksum.bend&start_line=23&end_line=27 import Base import bend-osdev-bytes@0.1.1.0/bytes.bend as B # the byte that, put at offset i of o (whose byte there is ignored), makes # o sum to zero modulo 256 def AcpiChecksum.byte_for(+i: Nat, +o: B.Octets) -> U32: +without = U32.and(255, U32.sub(AcpiChecksum.sum(o), U32.and(255, Maybe.default(&2, U32, B.Octets.at(o, i), 0)))) U32.and(255, U32.sub(256, without)) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe.default https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/checksum.bend&name=AcpiChecksum.sum https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.at