Mcfg.AcpiMcfg.of_sdt: def of bend-osdev-acpi@0.1.1.0 Import: import bend-osdev-acpi@0.1.1.0/mcfg.bend as Mcfg Lines 45-51 of bend-osdev-acpi@0.1.1.0/mcfg.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-acpi@0.1.1.0/mcfg.bend&start_line=45&end_line=51 import Base 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 # a checked table as an MCFG: the body is 8 reserved bytes and a whole # number of 16-byte structures (AcpiBadSize otherwise) def AcpiMcfg.of_sdt(t: H.AcpiSdt) -> Result<&2, &2, E.AcpiError, AcpiMcfg>: match t: case H.AcpiSdt{h, +body}: +n = B.Octets.len(body) mcfg.body(Bool.and(Nat.is_le(8n, n), Nat.is_eq(Nat.mod(Nat.sub(n, 8n), 16n), 0n)), h, body) Uses (11): 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.is_eq 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.mod https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result 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/header.bend&name=AcpiSdt https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/mcfg.bend&name=AcpiMcfg https://jend.leeeet.dev/definition.txt?path=bend-osdev-acpi@0.1.1.0/mcfg.bend&name=mcfg.body https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets.len