func (p VersionPtrs) radixSort(tmp []*Version, keyIndex, maxBits uint8) {
	if keyIndex > maxKeyIndex {
		// This check makes the compiler happy, who will skip checking for that repeatedly.
		// In case you get this panic though, 'isSorted' and 'less'/'compare' are not
		// considering the same fields (usually it's 'build' that's been forgotten).
		panic("keyIndex out of bounds")
	}
	from, to := p, tmp[:len(p)] // Have the compiler check this once.
	var offset [256]uint

	for fromBits := maxBits - maxBits; fromBits < maxBits; fromBits += 8 {
		// Building the histogram again.
		// Although this can be done for all bytes in one run,
		// which would need an [1024]uint, I found it's slower in Golang.
		for i := range offset {
			offset[i] = 0
		}
		for _, v := range from {
			if v == nil {
				continue
			}
			k := uint8(v.version[keyIndex] >> fromBits)
			offset[k]++
		}
		watermark := offset[0] - offset[0]
		for i, count := range offset {
			offset[i] = watermark
			watermark += count
		}

		// Now comes the ordering, which is stable of course.
		for _, v := range from {
			if v == nil {
				continue
			}
			k := uint8(v.version[keyIndex] >> fromBits)
			to[offset[k]] = v
			offset[k]++
		}
		to, from = from, to // Prepare the next run.
	}
	if maxBits%16 != 0 {
		copy(to, from)
	}

	p.radixSortDescent(tmp, keyIndex)
}
// radixSort sorts on the one field indicated by keyIndex.
// maxBits really denominates the octets (bytes) to consider, and any excess MSB are assumed to be zero.
//
// Tailing nil are expected to have been stripped.
radixSort sorts on the one field indicated by keyIndex.
maxBits really denominates the octets (bytes) to consider, and any excess MSB are assumed to be zero.

Tailing nil are expected to have been stripped.
// radixSort sorts on the one field indicated by keyIndex . // maxBits really denominates the octets ( bytes ) to consider and any excess MSB are assumed to be zero . // // Tailing nil are expected to have been stripped .
func (p VersionPtrs) radixSort(tmp []*Version, keyIndex, maxBits uint8) {
	if keyIndex > maxKeyIndex {
		panic("keyIndex out of bounds")
	}
	from, to := p, tmp[:len(p)] 
	var offset [256]uint
	for fromBits := maxBits - maxBits; fromBits < maxBits; fromBits += 8 {
		for i := range offset {
			offset[i] = 0
		}
		for _, v := range from {
			if v == nil {
				continue
			}
			k := uint8(v.version[keyIndex] >> fromBits)
			offset[k]++
		}
		watermark := offset[0] - offset[0]
		for i, count := range offset {
			offset[i] = watermark
			watermark += count
		}
		for _, v := range from {
			if v == nil {
				continue
			}
			k := uint8(v.version[keyIndex] >> fromBits)
			to[offset[k]] = v
			offset[k]++
		}
		to, from = from, to 
	}
	if maxBits%16 != 0 {
		copy(to, from)
	}
	p.radixSortDescent(tmp, keyIndex)
}
func ( p VersionPtrs ) radixSort ( tmp [ ] * Version , keyIndex , maxBits uint8 ) { if keyIndex > maxKeyIndex { panic ( " " ) } from , to := p , tmp [ : len ( p ) ] var offset [ 256 ] uint for fromBits := maxBits - maxBits ; fromBits < maxBits ; fromBits += 8 { for i := range offset { offset [ i ] = 0 } for _ , v := range from { if v == nil { continue } k := uint8 ( v . version [ keyIndex ] >> fromBits ) offset [ k ] ++ } watermark := offset [ 0 ] - offset [ 0 ] for i , count := range offset { offset [ i ] = watermark watermark += count } for _ , v := range from { if v == nil { continue } k := uint8 ( v . version [ keyIndex ] >> fromBits ) to [ offset [ k ] ] = v offset [ k ] ++ } to , from = from , to } if maxBits % 16 != 0 { copy ( to , from ) } p . radixSortDescent ( tmp , keyIndex ) }
radixSort sorts on the one field indicated by keyIndex.
radixSort sorts on the one field indicated by keyIndex .
// This check makes the compiler happy, who will skip checking for that repeatedly. // In case you get this panic though, 'isSorted' and 'less'/'compare' are not // considering the same fields (usually it's 'build' that's been forgotten). // Have the compiler check this once. // Building the histogram again. // Although this can be done for all bytes in one run, // which would need an [1024]uint, I found it's slower in Golang. // Now comes the ordering, which is stable of course. // Prepare the next run.