// Token: 0x06003A3C RID: 14908 RVA: 0x000DCF9B File Offset: 0x000DB19B internal static void IntrospectiveSort(TKey[] keys, TValue[] values, int left, int length, IComparer <TKey> comparer) { if (length < 2) { return; } ArraySortHelper <TKey, TValue> .IntroSort(keys, values, left, length + left - 1, 2 *IntrospectiveSortUtilities.FloorLog2(keys.Length), comparer); }
// Token: 0x06003A3D RID: 14909 RVA: 0x000DCFBC File Offset: 0x000DB1BC private static void IntroSort(TKey[] keys, TValue[] values, int lo, int hi, int depthLimit, IComparer <TKey> comparer) { while (hi > lo) { int num = hi - lo + 1; if (num <= 16) { if (num == 1) { return; } if (num == 2) { ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, lo, hi); return; } if (num == 3) { ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, lo, hi - 1); ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, lo, hi); ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, hi - 1, hi); return; } ArraySortHelper <TKey, TValue> .InsertionSort(keys, values, lo, hi, comparer); return; } else { if (depthLimit == 0) { ArraySortHelper <TKey, TValue> .Heapsort(keys, values, lo, hi, comparer); return; } depthLimit--; int num2 = ArraySortHelper <TKey, TValue> .PickPivotAndPartition(keys, values, lo, hi, comparer); ArraySortHelper <TKey, TValue> .IntroSort(keys, values, num2 + 1, hi, depthLimit, comparer); hi = num2 - 1; } } }
private static void IntroSort(TKey[] keys, TValue[] values, int lo, int hi, int depthLimit, IComparer <TKey> comparer) { int num1; for (; hi > lo; hi = num1 - 1) { int num2 = hi - lo + 1; if (num2 <= 16) { if (num2 == 1) { break; } if (num2 == 2) { ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, lo, hi); break; } if (num2 == 3) { ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, lo, hi - 1); ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, lo, hi); ArraySortHelper <TKey, TValue> .SwapIfGreaterWithItems(keys, values, comparer, hi - 1, hi); break; } ArraySortHelper <TKey, TValue> .InsertionSort(keys, values, lo, hi, comparer); break; } if (depthLimit == 0) { ArraySortHelper <TKey, TValue> .Heapsort(keys, values, lo, hi, comparer); break; } --depthLimit; num1 = ArraySortHelper <TKey, TValue> .PickPivotAndPartition(keys, values, lo, hi, comparer); ArraySortHelper <TKey, TValue> .IntroSort(keys, values, num1 + 1, hi, depthLimit, comparer); } }