Native stable digit-selection scan #
The scan appends a stable digit-selected subsequence to a disjoint destination array. Both orders of the two disjoint blocks are allowed, so consecutive radix passes can swap pointers. All loads, address calculations, stores and loop control are native instructions.
Main definitions #
Scan.body: read, test, conditionally append, and advance.Scan.code: reset the input cursor and scan the array.
Main results #
Scan.exec: stable selection with a linear instruction bound and memory frame.
Source pointer; the sorter returns the final sorted pointer here.
Digit selected by the current scan.
Current key digit.
Number of key bits, supplied by the caller.
Temporary used to swap the two pointers.
One stable-selection iteration, with every address and counter operation charged.
Reset the input cursor, then perform one stable-selection scan.
Append a stable digit-selected subsequence in 11n+3 instructions. The destination has
capacity n; source and destination blocks are disjoint, in either order. The caller's existing
destination prefix is retained. Only destination cells may change.