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

◆ PartialQuickSort() [2/2]

override void System.Linq.EnumerableSorter< TElement, TKey >.PartialQuickSort ( int[] map,
int left,
int right,
int minIdx,
int maxIdx )
inlineprotected

Definition at line 116 of file EnumerableSorter.cs.

117 {
118 do
119 {
120 int num = left;
121 int num2 = right;
122 int index = map[num + (num2 - num >> 1)];
123 while (true)
124 {
125 if (num < map.Length && CompareKeys(index, map[num]) > 0)
126 {
127 num++;
128 continue;
129 }
130 while (num2 >= 0 && CompareKeys(index, map[num2]) < 0)
131 {
132 num2--;
133 }
134 if (num > num2)
135 {
136 break;
137 }
138 if (num < num2)
139 {
140 int num3 = map[num];
141 map[num] = map[num2];
142 map[num2] = num3;
143 }
144 num++;
145 num2--;
146 if (num > num2)
147 {
148 break;
149 }
150 }
151 if (minIdx >= num)
152 {
153 left = num + 1;
154 }
155 else if (maxIdx <= num2)
156 {
157 right = num2 - 1;
158 }
159 if (num2 - left <= right - num)
160 {
161 if (left < num2)
162 {
164 }
165 left = num;
166 }
167 else
168 {
169 if (num < right)
170 {
171 PartialQuickSort(map, num, right, minIdx, maxIdx);
172 }
173 right = num2;
174 }
175 }
176 while (left < right);
177 }
void PartialQuickSort(int[] map, int left, int right, int minIdx, int maxIdx)
int CompareKeys(int index1, int index2)

References System.Linq.EnumerableSorter< TElement, TKey >.CompareKeys(), System.Linq.index, and System.Linq.EnumerableSorter< TElement, TKey >.PartialQuickSort().