def nm.path
bend-osdev-acpi@0.1.1.0 · aml_name.bend:183
import bend-osdev-acpi@0.1.1.0/aml_name.bend as AmlName
import Base
import bend-osdev-bytes@0.1.1.0/bytes.bend as B
183def nm.path(ss: List<&2, B.Octets>) -> List<&2, U32>:
184 match ss:
185 case Nil{}:
186 [0]
187 case Con{s, Nil{}}:
188 nm.segs.list([s])
189 case Con{s1, Con{s2, Nil{}}}:
190 Con{46, nm.segs.list([s1, s2])}
191 case Con{s1, Con{s2, Con{s3, +t}}}:
192 Con{47, Con{U32.from_nat(Nat.add(3n, nm.len(t))), nm.segs.list(Con{s1, Con{s2, Con{s3, t}}})}}