Fixed-code native unsigned radix sorter #
Two stable scans per bit partition the source into zeros followed by ones in scratch. Swapping the pointers avoids a copy-back scan. Code and registers are independent of length and key width. The source pointer on exit identifies the sorted array; the other block is scratch.
Main definitions #
pass: two digit scans and pointer swap.code: the complete radix sorter with a register-supplied bit bound.timeBound: explicit instruction bound, excluding halt.
Main results #
exec: complete charged sorting, with permutation, sortedness and a two-array frame.
Exchange source and scratch, then advance to the next bit.
Instances For
Exactly two stable scans per bit.
Instances For
Complete unsigned radix sorter. Parameters are length, two disjoint array bases, and bits. The returned source register identifies the sorted block.
Instances For
All instructions of radix sorting, excluding a final halt.
Instances For
Sort all keys below 2^keyBits in keyBits * (22n+15)+5 instructions. The two arrays
have length n, are adjacent, and start at caller-supplied base. Only these 2n cells may
change. The sorted block is returned in src; it is one of the two original blocks. This
includes empty lists and zero bit bounds. The key-bit bound and both one-past-end addresses
must fit; constant two must fit. No ordering contract is assumed.