Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IntroSort() [2/2]

static void System.Collections.Generic.GenericArraySortHelper< TKey, TValue >.IntroSort ( Span< TKey > keys,
Span< TValue > values,
int depthLimit )
inlinestaticprivate

Definition at line 556 of file GenericArraySortHelper.cs.

557 {
558 int num = keys.Length;
559 while (num > 1)
560 {
561 if (num <= 16)
562 {
563 switch (num)
564 {
565 case 2:
567 break;
568 case 3:
572 break;
573 default:
574 InsertionSort(keys.Slice(0, num), values.Slice(0, num));
575 break;
576 }
577 break;
578 }
579 if (depthLimit == 0)
580 {
581 HeapSort(keys.Slice(0, num), values.Slice(0, num));
582 break;
583 }
584 depthLimit--;
585 int num2 = PickPivotAndPartition(keys.Slice(0, num), values.Slice(0, num));
586 Span<TKey> span = keys;
587 Span<TKey> keys2 = span[(num2 + 1)..num];
588 Span<TValue> span2 = values;
589 IntroSort(keys2, span2[(num2 + 1)..num], depthLimit);
590 num = num2;
591 }
592 }
static void IntroSort(Span< T > keys, int depthLimit)
static void SwapIfGreaterWithValues(Span< TKey > keys, Span< TValue > values, int i, int j)

References System.Collections.Generic.GenericArraySortHelper< TKey, TValue >.HeapSort(), System.Collections.Generic.GenericArraySortHelper< TKey, TValue >.InsertionSort(), System.Collections.Generic.GenericArraySortHelper< TKey, TValue >.IntroSort(), System.keys, System.Collections.Generic.GenericArraySortHelper< TKey, TValue >.PickPivotAndPartition(), System.Collections.Generic.GenericArraySortHelper< TKey, TValue >.SwapIfGreaterWithValues(), and System.values.