def tm.hex.pick

bend-osdev-acpi@0.1.1.0 · aml_term.bend:153

import bend-osdev-acpi@0.1.1.0/aml_term.bend as AmlTerm
import Base

153# EISAID("PNP0A03") (chapter 19, EISAID): three letters of five bits each and four hex
154# digits, stored most significant byte first, as a DWord
155def tm.hex.pick(digit: Bool, upper: Bool, +c: U32) -> U32:
156  match digit:
157    case True{}:
158      U32.sub(c, 48)
159    case False{}:
160      match upper:
161        case True{}:
162          U32.and(U32.sub(c, 55), 15)
163        case False{}:
164          U32.and(U32.sub(c, 87), 15)

Uses (4)

Used by (1)