def mem.near

bend-osdev-acpi@0.1.1.0 · acpi.bend:40

import bend-osdev-acpi@0.1.1.0/acpi.bend as Acpi
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

40# the offset into the region is computed only once it is known to be small
41# (a Nat holds at most 2^48 - 1 at run time)
42def mem.near(near: Bool, +off: W.W64, +n: Nat, +o: B.Octets) -> Maybe<&2, B.Octets>:
43  match near:
44    case False{}:
45      None{}
46    case True{}:
47      +k = U32.to_nat(W.W64.lo(off))
48      mem.slice(Nat.is_le(Nat.add(k, n), B.Octets.len(o)), k, n, o)

Uses (11)

Used by (1)