def u32_wrapping_shl
import bend-collections-laws-math@1.0.0.0/src/math/fixed.bend as Fixedimport Base
import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as X
146# shifts by s mod 32 (Rust masks the amount the same way); a left shift is
147# the product with 2^k modulo 2^32
148def u32_wrapping_shl(+a: U32, +s: U32) -> U32:
149 U32.mul(a, X.pow2(U32.to_nat(U32.and(s, 31))))