def mix32

bendtorch@1.3.0.0 · main.bend:1235

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base

1235# lowbias32 (Chris Wellons): an invertible mix of the 32 bits
1236def mix32(+x: U32) -> U32:
1237  +a = U32.xor(x, U32.shrn(x, 16n))
1238  +b = (a * 2146121005 : U32)
1239  +c = U32.xor(b, U32.shrn(b, 15n))
1240  +d = (c * 2221713035 : U32)
1241  U32.xor(d, U32.shrn(d, 16n))

Uses (4)

Used by (2)