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

◆ IntroSort()

void System.Array.SorterObjectArray.IntroSort ( int lo,
int hi,
int depthLimit )
inlineprivate

Definition at line 91 of file Array.cs.

92 {
93 while (hi > lo)
94 {
95 int num = hi - lo + 1;
96 if (num <= 16)
97 {
98 switch (num)
99 {
100 case 2:
101 SwapIfGreater(lo, hi);
102 break;
103 case 3:
104 SwapIfGreater(lo, hi - 1);
105 SwapIfGreater(lo, hi);
106 SwapIfGreater(hi - 1, hi);
107 break;
108 default:
109 InsertionSort(lo, hi);
110 break;
111 }
112 break;
113 }
114 if (depthLimit == 0)
115 {
116 Heapsort(lo, hi);
117 break;
118 }
119 depthLimit--;
120 int num2 = PickPivotAndPartition(lo, hi);
122 hi = num2 - 1;
123 }
124 }
void Heapsort(int lo, int hi)
Definition Array.cs:157
void IntroSort(int lo, int hi, int depthLimit)
Definition Array.cs:91
void InsertionSort(int lo, int hi)
Definition Array.cs:201
int PickPivotAndPartition(int lo, int hi)
Definition Array.cs:126
void SwapIfGreater(int a, int b)
Definition Array.cs:37

References System.Array.SorterObjectArray.Heapsort(), System.Array.SorterObjectArray.InsertionSort(), System.Array.SorterObjectArray.IntroSort(), System.Array.SorterObjectArray.PickPivotAndPartition(), and System.Array.SorterObjectArray.SwapIfGreater().

Referenced by System.Array.SorterObjectArray.IntroSort(), and System.Array.SorterObjectArray.IntrospectiveSort().