func (p VersionPtrs) multikeyRadixSortDescent(tmp []*Version, keyIndex uint8, offset [256]int) {
	// Collapse resolved lower fields if below unresolved larger fields.
	// Consider 2007.9 and 2008.6 that both map to 0b0011… and would be misordered as 9>6.
	for i := uint8(12); i < 16; i++ { // 12 to 15 represent "unresolved"/"consider N-11 digits".
		strideEnd := offset[i<<4|0x0f]
		for j := i << 4; j < (i<<4 | 0x0f); j++ {
			offset[j] = strideEnd
		}
	}

	// Any tailing nil are beyond offsets, henceforth no longer considered.
	watermark := offset[0] - offset[0]
	for k, ceiling := range offset {
		subsliceLen := ceiling - watermark // aka "stride"
		if subsliceLen < 2 {
			watermark = ceiling
			continue
		}

		// Recursion depth is contained in this paragraph.
		// If 'compare' or 'less' for a particular architecture considers the 'build' suffix
		// then so must 'isSorted' for this to work.
		subslice := p[watermark:ceiling]
		watermark = ceiling
		unresolvedLeftSide := uint8(k) >= (12 << 4)
		if (!unresolvedLeftSide || subsliceLen < thresholdForResidualSort) &&
			// Else the probability to encounter an already sorted stride is too low.
			subslice.isSorted(uint(keyIndex)) {
			continue
		}
		if subsliceLen < thresholdForResidualSort {
			sort.Sort(subslice)
			continue
		}

		switch k := uint8(k); {
		case unresolvedLeftSide: // Unsorted trailer with values that keyFn did not resolve.
			maxBits := ((k >> 4) - 11) * 8
			subslice.radixSort(tmp, keyIndex, maxBits)
		case (k & 0x0f) >= 12: // This key is in order, the next is not: descent.
			maxBits := ((k & 0x0f) - 11) * 8 // 12 → 1 → 8
			subslice.radixSort(tmp, keyIndex+1, maxBits)
		default:
			subslice.multikeyRadixSort(tmp, keyIndex+2)
		}
	}
}
// multikeyRadixSortDescent is multikeyRadixSort's outsourced descent- and recurse steps.
// Extracted for easier profiling.
multikeyRadixSortDescent is multikeyRadixSort's outsourced descent- and recurse steps.
Extracted for easier profiling.
// multikeyRadixSortDescent is multikeyRadixSort ' s outsourced descent - and recurse steps . // Extracted for easier profiling .
func (p VersionPtrs) multikeyRadixSortDescent(tmp []*Version, keyIndex uint8, offset [256]int) {
	for i := uint8(12); i < 16; i++ { 
		strideEnd := offset[i<<4|0x0f]
		for j := i << 4; j < (i<<4 | 0x0f); j++ {
			offset[j] = strideEnd
		}
	}
	watermark := offset[0] - offset[0]
	for k, ceiling := range offset {
		subsliceLen := ceiling - watermark 
		if subsliceLen < 2 {
			watermark = ceiling
			continue
		}
		subslice := p[watermark:ceiling]
		watermark = ceiling
		unresolvedLeftSide := uint8(k) >= (12 << 4)
		if (!unresolvedLeftSide || subsliceLen < thresholdForResidualSort) &&
			subslice.isSorted(uint(keyIndex)) {
			continue
		}
		if subsliceLen < thresholdForResidualSort {
			sort.Sort(subslice)
			continue
		}
		switch k := uint8(k); {
		case unresolvedLeftSide: 
			maxBits := ((k >> 4) - 11) * 8
			subslice.radixSort(tmp, keyIndex, maxBits)
		case (k & 0x0f) >= 12: 
			maxBits := ((k & 0x0f) - 11) * 8 
			subslice.radixSort(tmp, keyIndex+1, maxBits)
		default:
			subslice.multikeyRadixSort(tmp, keyIndex+2)
		}
	}
}
func ( p VersionPtrs ) multikeyRadixSortDescent ( tmp [ ] * Version , keyIndex uint8 , offset [ 256 ] int ) { for i := uint8 ( 12 ) ; i < 16 ; i ++ { strideEnd := offset [ i << 4 | 0x0f ] for j := i << 4 ; j < ( i << 4 | 0x0f ) ; j ++ { offset [ j ] = strideEnd } } watermark := offset [ 0 ] - offset [ 0 ] for k , ceiling := range offset { subsliceLen := ceiling - watermark if subsliceLen < 2 { watermark = ceiling continue } subslice := p [ watermark : ceiling ] watermark = ceiling unresolvedLeftSide := uint8 ( k ) >= ( 12 << 4 ) if ( ! unresolvedLeftSide || subsliceLen < thresholdForResidualSort ) && subslice . isSorted ( uint ( keyIndex ) ) { continue } if subsliceLen < thresholdForResidualSort { sort . Sort ( subslice ) continue } switch k := uint8 ( k ) ; { case unresolvedLeftSide : maxBits := ( ( k >> 4 ) - 11 ) * 8 subslice . radixSort ( tmp , keyIndex , maxBits ) case ( k & 0x0f ) >= 12 : maxBits := ( ( k & 0x0f ) - 11 ) * 8 subslice . radixSort ( tmp , keyIndex + 1 , maxBits ) default : subslice . multikeyRadixSort ( tmp , keyIndex + 2 ) } } }
multikeyRadixSortDescent is multikeyRadixSort's outsourced descent- and recurse steps.
multikeyRadixSortDescent is multikeyRadixSort ' s outsourced descent - and recurse steps .
// Collapse resolved lower fields if below unresolved larger fields. // Consider 2007.9 and 2008.6 that both map to 0b0011… and would be misordered as 9>6. // 12 to 15 represent "unresolved"/"consider N-11 digits". // Any tailing nil are beyond offsets, henceforth no longer considered. // aka "stride" // Recursion depth is contained in this paragraph. // If 'compare' or 'less' for a particular architecture considers the 'build' suffix // then so must 'isSorted' for this to work. // Else the probability to encounter an already sorted stride is too low. // Unsorted trailer with values that keyFn did not resolve. // This key is in order, the next is not: descent. // 12 → 1 → 8