func rootradixsort(arr []*gcRoot, lo, hi int, bit uint) {
	// Partition the array into two bins based on the values at the
	// specified bit position: 0's bin (grown from the left) and and
	// 1's bin (grown from the right). We keep two boundary markers,
	// the 0's boundary "zbb" (which grows to the right) and the 1's
	// boundary "obb" (which grows to the left). At each step we
	// examine the bit for the right-of-ZBB element: if it is zero, we
	// leave it in place and move the ZBB to the right. If the bit is
	// not zero, then we swap the ZBB and OBB elements and move the
	// OBB to the left. When this is done, the two partitions are then
	// sorted using the next lower bit.

	// 0's bin boundary, initially set to before the first element
	zbb := lo - 1
	// 1's bin boundary, set to just beyond the last element
	obb := hi + 1
	// mask to pick up bit of interest
	bmask := uintptr(1) << bit

	for obb-zbb > 1 {
		zbbval := uintptr(arr[zbb+1].decl) & bmask
		if zbbval == 0 {
			// Move zbb one to the right
			zbb++
		} else {
			// Move obb one to the left and swap
			arr[obb-1], arr[zbb+1] = arr[zbb+1], arr[obb-1]
			obb--
		}
	}

	if bit != 0 {
		// NB: in most cases there is just a single partition to visit
		// so if we wanted to reduce stack space we could check for this
		// and insert a goto back up to the top.
		if zbb-lo > 0 {
			rootradixsort(arr, lo, zbb, bit-1)
		}
		if hi-obb > 0 {
			rootradixsort(arr, obb, hi, bit-1)
		}
	}
}
// rootradixsort performs an in-place radix sort of the 'arr' rootptr slice.
// Note: not a stable sort, however we expect it to be called only on slices
// with no duplicate entries, so this should not matter.
rootradixsort performs an in-place radix sort of the 'arr' rootptr slice.
Note: not a stable sort, however we expect it to be called only on slices
with no duplicate entries, so this should not matter.
// rootradixsort performs an in - place radix sort of the ' arr ' rootptr slice . // Note : not a stable sort however we expect it to be called only on slices // with no duplicate entries so this should not matter .
func rootradixsort(arr []*gcRoot, lo, hi int, bit uint) {
	zbb := lo - 1
	obb := hi + 1
	bmask := uintptr(1) << bit
	for obb-zbb > 1 {
		zbbval := uintptr(arr[zbb+1].decl) & bmask
		if zbbval == 0 {
			zbb++
		} else {
			arr[obb-1], arr[zbb+1] = arr[zbb+1], arr[obb-1]
			obb--
		}
	}
	if bit != 0 {
		if zbb-lo > 0 {
			rootradixsort(arr, lo, zbb, bit-1)
		}
		if hi-obb > 0 {
			rootradixsort(arr, obb, hi, bit-1)
		}
	}
}
func rootradixsort ( arr [ ] * gcRoot , lo , hi int , bit uint ) { zbb := lo - 1 obb := hi + 1 bmask := uintptr ( 1 ) << bit for obb - zbb > 1 { zbbval := uintptr ( arr [ zbb + 1 ] . decl ) & bmask if zbbval == 0 { zbb ++ } else { arr [ obb - 1 ] , arr [ zbb + 1 ] = arr [ zbb + 1 ] , arr [ obb - 1 ] obb -- } } if bit != 0 { if zbb - lo > 0 { rootradixsort ( arr , lo , zbb , bit - 1 ) } if hi - obb > 0 { rootradixsort ( arr , obb , hi , bit - 1 ) } } }
rootradixsort performs an in-place radix sort of the 'arr' rootptr slice.
rootradixsort performs an in - place radix sort of the ' arr ' rootptr slice .
// Partition the array into two bins based on the values at the // specified bit position: 0's bin (grown from the left) and and // 1's bin (grown from the right). We keep two boundary markers, // the 0's boundary "zbb" (which grows to the right) and the 1's // boundary "obb" (which grows to the left). At each step we // examine the bit for the right-of-ZBB element: if it is zero, we // leave it in place and move the ZBB to the right. If the bit is // not zero, then we swap the ZBB and OBB elements and move the // OBB to the left. When this is done, the two partitions are then // sorted using the next lower bit. // 0's bin boundary, initially set to before the first element // 1's bin boundary, set to just beyond the last element // mask to pick up bit of interest // Move zbb one to the right // Move obb one to the left and swap // NB: in most cases there is just a single partition to visit // so if we wanted to reduce stack space we could check for this // and insert a goto back up to the top.