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

◆ InsertionSort() [2/2]

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

Definition at line 416 of file ArraySortHelper.cs.

417 {
418 for (int i = 0; i < keys.Length - 1; i++)
419 {
420 TKey val = keys[i + 1];
421 TValue val2 = values[i + 1];
422 int num = i;
423 while (num >= 0 && comparer.Compare(val, keys[num]) < 0)
424 {
425 keys[num + 1] = keys[num];
426 values[num + 1] = values[num];
427 num--;
428 }
429 keys[num + 1] = val;
430 values[num + 1] = val2;
431 }
432 }

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