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

◆ DownHeap() [1/2]

static void System.Collections.Generic.ArraySortHelper< TKey, TValue >.DownHeap ( Span< T > keys,
int i,
int n,
Comparison< T > comparer )
inlinestaticprivate

Definition at line 209 of file ArraySortHelper.cs.

210 {
211 T val = keys[i - 1];
212 while (i <= n >> 1)
213 {
214 int num = 2 * i;
215 if (num < n && comparer(keys[num - 1], keys[num]) < 0)
216 {
217 num++;
218 }
219 if (comparer(val, keys[num - 1]) >= 0)
220 {
221 break;
222 }
223 keys[i - 1] = keys[num - 1];
224 i = num;
225 }
226 keys[i - 1] = val;
227 }

References System.comparer, and System.keys.

Referenced by System.Collections.Generic.ArraySortHelper< TKey, TValue >.HeapSort(), and System.Collections.Generic.ArraySortHelper< TKey, TValue >.HeapSort().