def AmlUnit.put
import bend-osdev-acpi@0.1.1.0/aml_field.bend as AmlFieldimport Base
import bend-osdev-word64@0.1.1.0/word64.bend as W
126# the unit's share of the field's value x, in place in the unit
127def AmlUnit.put(u: AmlUnit, +x: W.W64) -> W.W64:
128 match u:
129 case AmlUnit{a, +s, +n, +d, ok}:
130 W.W64.shl(W.W64.and(W.W64.shr(x, d), fld.mask(n)), s)