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

◆ HeapifyRoot()

void System.Linq.Parallel.FixedMaxHeap< TElement >.HeapifyRoot ( )
inlineprivate

Definition at line 81 of file FixedMaxHeap.cs.

82 {
83 int num = 0;
84 int count = _count;
85 while (num < count)
86 {
87 int num2 = (num + 1) * 2 - 1;
88 int num3 = num2 + 1;
89 if (num2 < count && _comparer.Compare(_elements[num], _elements[num2]) < 0)
90 {
92 {
93 Swap(num, num3);
94 num = num3;
95 }
96 else
97 {
98 Swap(num, num2);
99 num = num2;
100 }
101 }
102 else
103 {
104 if (num3 >= count || _comparer.Compare(_elements[num], _elements[num3]) >= 0)
105 {
106 break;
107 }
108 Swap(num, num3);
109 num = num3;
110 }
111 }
112 }
readonly TElement[] _elements
readonly IComparer< TElement > _comparer

References System.Linq.Parallel.FixedMaxHeap< TElement >._comparer, System.Linq.Parallel.FixedMaxHeap< TElement >._count, System.Linq.Parallel.FixedMaxHeap< TElement >._elements, System.Collections.Generic.IComparer< in T >.Compare(), System.Linq.count, and System.Linq.Parallel.FixedMaxHeap< TElement >.Swap().

Referenced by System.Linq.Parallel.FixedMaxHeap< TElement >.Insert(), System.Linq.Parallel.FixedMaxHeap< TElement >.RemoveMax(), and System.Linq.Parallel.FixedMaxHeap< TElement >.ReplaceMax().