Fixed-code native sorting and multiplicity construction from machine input #
The input is the ordinary native list of unsigned words. The code reads its length and the
physical word width, and uses that width as an explicit key-bit bound. The lower-level
deduplicateCode accepts a smaller caller-supplied bit bound when known.
The standard-input wrapper's charged bound is O(n * w) for positive n and w.
The key array starts at 1+2n, the count array at 1+3n; the return value is their common
logical length. The two sorting buffers occupy [1,1+2n). The implementation accepts repeated
keys, zero keys and canonical signed integer encodings. Its order is unsigned encoding order.
Main definitions #
inputCode,program: the complete structured and flat native programs.layoutWidth: a logarithmic width sufficient for all four array blocks.
Main results #
input_exec: charged execution from ordinary native input, with exact key/count output.layout_fits: logarithmic-width layout fit, including empty input.
Read the native input header and width, then sort and construct both output arrays.
Instances For
The fixed native instruction list, returning the number of unique keys.
Instances For
A logarithmic layout-width schedule; the key magnitude bound is independent.
Instances For
Four array blocks and both initialization constants fit at the layout-width threshold. This does not by itself bound input key magnitudes.
Execute the complete finite native program on the standard input convention. The bound
includes the final halt and every setup/address/control instruction. Input fit and the explicit
4n+1 layout fit are independent requirements. Empty and singleton inputs need no exceptions.
The output words enumerate exactly the input set and each stored count is its full multiplicity.