Based on Boost C++ integer_sort. Checks for sorted input while finding min and max, computes value-proportional bucket indices, and permutes elements in-place via a 3-way swap loop. Each bucket is evaluated against a dynamic threshold to decide between further spreading or falling back to PDQSort.
Arrays under 1000 elements skip spreading and fall back to PDQSort. The radix width per level can consume all remaining bits in one pass when the range is small enough. Dynamic fallback thresholds consider the remaining bit range, giving finer control than subproblem size alone.