def merge
import lawful-words@0.1.0.0/defs.bend as Defsimport Base
51# The word that starts r bytes into the pair (lo, hi), r from 0 to 4:
52# (lo >> 8r) | (hi << 8(4 - r)). Copying at any alignment reads such words.
53def merge(lo: U32, hi: U32, +r: Nat) -> U32:
54 U32.or(U32.shrn(lo, Nat.mul(8n, r)), U32.shln(hi, Nat.mul(8n, Nat.sub(4n, r))))