Slit.slit.body: def of bend-osdev-acpi@0.1.1.0 Import: import bend-osdev-acpi@0.1.1.0/slit.bend as Slit Lines 28-35 of bend-osdev-acpi@0.1.1.0/slit.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-acpi@0.1.1.0/slit.bend&start_line=28&end_line=35 import Base import bend-osdev-word64@0.1.1.0/word64.bend as W import bend-osdev-bytes@0.1.1.0/bytes.bend as B import bend-osdev-acpi@0.1.1.0/error.bend as E import bend-osdev-acpi@0.1.1.0/header.bend as H import bend-osdev-acpi@0.1.1.0/fields.bend as F def slit.body(ok: Bool, +h: H.AcpiHeader, +body: B.Octets) -> Result<&2, &2, E.AcpiError, AcpiSlit>: match ok: case False{}: Fail{E.AcpiTooShort{44n, Nat.add(36n, B.Octets.len(body))}} case True{}: +big = F.AcpiF.u64(body, 0n) +n = U32.to_nat(W.W64.lo(big)) slit.mk(Bool.and(U32.is_eq(W.W64.hi(big), 0), Bool.and(U32.is_lt(W.W64.lo(big), 65536), Nat.is_le(Nat.add(8n, Nat.mul(n, n)), B.Octets.len(body)))), h, n, body) Uses (18): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/error.bend&name=AcpiError https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/fields.bend&name=AcpiF.u64 https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/header.bend&name=AcpiHeader https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/slit.bend&name=AcpiSlit https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/slit.bend&name=slit.mk 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.len https://jend.leeeet.dev/definition.txt?path=bend-osdev-word64@0.1.1.0/word64.bend&name=W64.hi https://jend.leeeet.dev/definition.txt?path=bend-osdev-word64@0.1.1.0/word64.bend&name=W64.lo