Checked transfers between scalar words and digit lists #
Register lists and supplied constants determine the unrolled standard-basis code. Digits are little endian in the half-word radix. Registers zero through three are reserved workspace.
Main definitions #
Cslib.WordRAM.Multiword.Transfer.copy: copy disjoint equal-length register lists.Cslib.WordRAM.Multiword.Transfer.constants: install a supplied list of constants.Cslib.WordRAM.Multiword.Transfer.assemble: reconstruct a scalar from digit registers.Cslib.WordRAM.Multiword.Transfer.split: split a physical scalar into digit registers.
Main results #
Cslib.WordRAM.Multiword.Transfer.exec_copy: exact copying and register preservation.Cslib.WordRAM.Multiword.Transfer.exec_constants: exact installation of bounded constants.Cslib.WordRAM.Multiword.Transfer.exec_assemble: reconstruction when the scalar fits.Cslib.WordRAM.Multiword.Transfer.exec_split_eighteen: exact eighteen-digit conversion.
References #
Copying preserves the exact digit sequence, memory, and every register outside the outputs. Source registers need not be distinct.
Reconstruct by Horner evaluation, high digits first, into workspace register zero.
Instances For
Reconstruction is checked at the original physical width. All intermediate Horner values
fit because the nonnegative final scalar fits. Inputs are preserved when disjoint from d.
The frame includes the radix and zero workspace alongside the destination.
Extract low digits by remainder and division, retaining the final quotient in total.
Instances For
Exact conversion when the supplied digit list has enough capacity. The input may occur among the outputs: its value is copied into workspace before any digit is written.
Eighteen half-word digits suffice for every physical scalar at widths at least two, including odd widths. This conversion always executes exactly 44 instructions.