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

◆ DownHeap()

void System.Array.SorterObjectArray.DownHeap ( int i,
int n,
int lo )
inlineprivate

Definition at line 171 of file Array.cs.

172 {
173 object obj = keys[lo + i - 1];
174 object[] array = items;
175 object obj2 = ((array != null) ? array[lo + i - 1] : null);
176 while (i <= n / 2)
177 {
178 int num = 2 * i;
179 if (num < n && comparer.Compare(keys[lo + num - 1], keys[lo + num]) < 0)
180 {
181 num++;
182 }
183 if (comparer.Compare(obj, keys[lo + num - 1]) >= 0)
184 {
185 break;
186 }
187 keys[lo + i - 1] = keys[lo + num - 1];
188 if (items != null)
189 {
190 items[lo + i - 1] = items[lo + num - 1];
191 }
192 i = num;
193 }
194 keys[lo + i - 1] = obj;
195 if (items != null)
196 {
197 items[lo + i - 1] = obj2;
198 }
199 }
readonly object[] items
Definition Array.cs:26
readonly object[] keys
Definition Array.cs:24
readonly IComparer comparer
Definition Array.cs:28

References System.array, System.Collections.Generic.IComparer< in T >.Compare(), System.Array.SorterObjectArray.comparer, System.Array.SorterObjectArray.items, System.Array.SorterObjectArray.keys, and System.obj.

Referenced by System.Array.SorterObjectArray.Heapsort().