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

◆ DownHeap() [2/2]

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

Definition at line 393 of file ArraySortHelper.cs.

394 {
395 TKey val = keys[i - 1];
396 TValue val2 = values[i - 1];
397 while (i <= n >> 1)
398 {
399 int num = 2 * i;
400 if (num < n && comparer.Compare(keys[num - 1], keys[num]) < 0)
401 {
402 num++;
403 }
404 if (comparer.Compare(val, keys[num - 1]) >= 0)
405 {
406 break;
407 }
408 keys[i - 1] = keys[num - 1];
409 values[i - 1] = values[num - 1];
410 i = num;
411 }
412 keys[i - 1] = val;
413 values[i - 1] = val2;
414 }

References System.comparer, System.keys, and System.values.