def le_bytes

bend-collections@1.0.0.0 · src/crypto/random.bend:90

import bend-collections@1.0.0.0/src/crypto/random.bend as Random
import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
import bend-collections@1.0.0.0/src/math/w64.bend as X

90# the eight little-endian bytes of a 64-bit word
91def le_bytes(+x: W.U64) -> List<&2, U32>:
92  +l = X.lo(x)
93  +h = X.hi(x)
94  [U32.and(l, 255), U32.and(U32.shrn(l, 8n), 255), U32.and(U32.shrn(l, 16n), 255), U32.and(U32.shrn(l, 24n), 255), U32.and(h, 255), U32.and(U32.shrn(h, 8n), 255), U32.and(U32.shrn(h, 16n), 255), U32.and(U32.shrn(h, 24n), 255)]

Uses (7)

Used by (1)