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

◆ Resize() [2/2]

Container System.Runtime.CompilerServices.ConditionalWeakTable< TKey, TValue >.Container.Resize ( int newSize)
inlinepackage

Definition at line 264 of file ConditionalWeakTable.cs.

265 {
266 int[] array = new int[newSize];
267 for (int i = 0; i < array.Length; i++)
268 {
269 array[i] = -1;
270 }
271 Entry[] array2 = new Entry[newSize];
272 int j = 0;
273 bool flag = _parent != null && _parent._activeEnumeratorRefCount > 0;
274 if (flag)
275 {
276 for (; j < _entries.Length; j++)
277 {
280 int num = (reference2.HashCode = reference.HashCode);
281 reference2.depHnd = reference.depHnd;
282 int num2 = num & (array.Length - 1);
283 reference2.Next = array[num2];
284 array[num2] = j;
285 }
286 }
287 else
288 {
289 for (int k = 0; k < _entries.Length; k++)
290 {
292 int hashCode = reference3.HashCode;
293 DependentHandle depHnd = reference3.depHnd;
294 if (hashCode != -1 && depHnd.IsAllocated)
295 {
296 if (depHnd.UnsafeGetTarget() != null)
297 {
299 reference4.HashCode = hashCode;
300 reference4.depHnd = depHnd;
301 int num3 = hashCode & (array.Length - 1);
302 reference4.Next = array[num3];
303 array[num3] = j;
304 j++;
305 }
306 else
307 {
308 Volatile.Write(ref reference3.HashCode, -1);
309 }
310 }
311 }
312 }
313 Container container = new Container(_parent, array, array2, j);
314 if (flag)
315 {
316 GC.SuppressFinalize(this);
317 }
318 _oldKeepAlive = container;
319 GC.KeepAlive(this);
320 return container;
321 }
static void Write(ref bool location, bool value)
Definition Volatile.cs:74

References System.Runtime.CompilerServices.ConditionalWeakTable< TKey, TValue >.Container.Container(), System.Runtime.CompilerServices.ConditionalWeakTable< TKey, TValue >.Container._entries, System.Runtime.CompilerServices.ConditionalWeakTable< TKey, TValue >.Container._oldKeepAlive, System.Runtime.CompilerServices.ConditionalWeakTable< TKey, TValue >.Container._parent, System.array, System.Runtime.DependentHandle.IsAllocated, System.GC.KeepAlive(), System.newSize, System.GC.SuppressFinalize(), System.Runtime.DependentHandle.UnsafeGetTarget(), and System.Threading.Volatile.Write().