Native Euclidean residue arrays #
The input holds signed encodings. The output holds ordinary unsigned residue keys, ready for histogram construction. In particular a nonnegative encoded integer is explicitly decoded by division by two before it is used as a histogram index.
Main definitions #
Residues.program: a fixed loop producing Euclidean residue keys.
Main results #
Residues.exec: charged execution preserving the input and all cells outside the output.
References #
Encoded integer input base.
Unsigned residue output base.
Input length.
Encoded modulus.
Loop counter.
Address scratch.
Constant one.
The signed remainder block followed by explicit unsigned decoding and a store.
All parameters are supplied at runtime; registers and code are independent of length and width.
Convert n encoded signed integers to unsigned Euclidean residue keys in at most
23n + 4 native instructions. The modulus is positive and encoded in its parameter register;
addresses are ordinary unsigned words. The final halt is excluded.