Product32
Mojo struct 🡭
Product32
@memory_only
struct Product32Unreduced 256-bit carryless product stored as eight 32-bit limbs (lo … hi).
Implemented traits
AnyType, Copyable, Deinitable, Movable
Methods
__init__
fn def __init__(out self, var zw: Array[UInt32, Int(8)])Args:
- zw (
Array[UInt32, Int(8)]) - self (
Self)
Returns:
Self
mont_reduce
fn def mont_reduce(self) -> Array[UInt8, Int(16)]Reduce mod x^128 + x^127 + x^126 + x^121 + 1 using shift/XOR folding.
Equivalent to the 64-bit reduction but split across 32-bit limbs.
zw[3] is updated in i=0 and read back as lw in i=3 — the sequential
dependency is load-bearing, so the loop is unrolled.
Args:
- self (
Self)
Returns:
Array[UInt8, Int(16)]