Expand description
The Galois LFSR permutation: one body for the shuffle node and for
jit_shuffle, the helper native code calls.
The two carried a copy each until 2026-09-22, and the copies drifted
the way copies do — a zero size divided by zero in both, and a
guard written into one would have made the engines disagree about
the same program. They are one function now, which is what this
module is for.
The feedback polynomials come with it. A shuffle whose polynomial
does not match its register width is not a permutation, so the table
and the body are one thing to keep honest, not two; splitting them
across the crates is what let the bodies diverge in the first place.
polydat-nodes re-exports the selection helpers under their old
paths.
Functions§
- feedback_
for_ size - Convenience: derive a bank-0 feedback polynomial directly from a
shuffle
size. Callers building aShufflenode from an outer “size” parameter use this rather than tracking width / bank manually. - feedback_
for_ width - Return the default (bank 0) feedback polynomial for a given width.
- feedback_
for_ width_ and_ bank - Return the feedback polynomial for a given register width and bank.
- lfsr_
step - One step of the Galois LFSR: shift right, and fold in the feedback polynomial when the bit shifted out was set.
- shuffle_
bounded - Map
inputinto[min, min + size), visiting every value of that range exactly once per cycle. - width_
for_ period - Return the minimum register width needed to represent
periodvalues.