internal static void IntrospectiveSort(T[] keys, int left, int length) { if (length < 2) { return; } GenericArraySortHelper <T> .IntroSort(keys, left, length + left - 1, 2 *IntrospectiveSortUtilities.FloorLog2(keys.Length)); }
// Token: 0x06003A2F RID: 14895 RVA: 0x000DC9C4 File Offset: 0x000DABC4 private static void IntroSort(T[] keys, int lo, int hi, int depthLimit) { while (hi > lo) { int num = hi - lo + 1; if (num <= 16) { if (num == 1) { return; } if (num == 2) { GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, lo, hi); return; } if (num == 3) { GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, lo, hi - 1); GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, lo, hi); GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, hi - 1, hi); return; } GenericArraySortHelper <T> .InsertionSort(keys, lo, hi); return; } else { if (depthLimit == 0) { GenericArraySortHelper <T> .Heapsort(keys, lo, hi); return; } depthLimit--; int num2 = GenericArraySortHelper <T> .PickPivotAndPartition(keys, lo, hi); GenericArraySortHelper <T> .IntroSort(keys, num2 + 1, hi, depthLimit); hi = num2 - 1; } } }
private static void IntroSort(T[] keys, int lo, int hi, int depthLimit) { int num1; for (; hi > lo; hi = num1 - 1) { int num2 = hi - lo + 1; if (num2 <= 16) { if (num2 == 1) { break; } if (num2 == 2) { GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, lo, hi); break; } if (num2 == 3) { GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, lo, hi - 1); GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, lo, hi); GenericArraySortHelper <T> .SwapIfGreaterWithItems(keys, hi - 1, hi); break; } GenericArraySortHelper <T> .InsertionSort(keys, lo, hi); break; } if (depthLimit == 0) { GenericArraySortHelper <T> .Heapsort(keys, lo, hi); break; } --depthLimit; num1 = GenericArraySortHelper <T> .PickPivotAndPartition(keys, lo, hi); GenericArraySortHelper <T> .IntroSort(keys, num1 + 1, hi, depthLimit); } }