def le32

bend-osdev-bytes@0.1.1.0 · bytes.bend:125

import bend-osdev-bytes@0.1.1.0/bytes.bend as Bytes
import Base
import bend-osdev-word64@0.1.1.0/word64.bend as W

125# the four bytes of a word, least significant first
126def le32(+v: U32) -> List<&2, U32>:
127  match v:
128    case U32{w}:
129      +r1 = W.W64.bits.hi(8n, 24n, w)
130      +r2 = W.W64.bits.hi(8n, 16n, r1)
131      [of_bits8(W.W64.bits.lo(8n, 24n, w)), of_bits8(W.W64.bits.lo(8n, 16n, r1)), of_bits8(W.W64.bits.lo(8n, 8n, r2)), of_bits8(W.W64.bits.hi(8n, 8n, r2))]

Uses (5)

Used by (30)