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

◆ this[K key]

V System.Reflection.CerHashtable< K, V >.this[K key]
getsetpackage

Definition at line 53 of file CerHashtable.cs.

54 {
55 get
56 {
57 Table table = Volatile.Read(ref m_Table);
58 if (table == null)
59 {
60 return default(V);
61 }
62 int num = GetHashCodeHelper(key);
63 if (num < 0)
64 {
65 num = ~num;
66 }
67 K[] keys = table.m_keys;
68 int num2 = num % keys.Length;
69 while (true)
70 {
71 K val = Volatile.Read(ref keys[num2]);
72 if (val == null)
73 {
74 break;
75 }
76 if (val.Equals(key))
77 {
78 return table.m_values[num2];
79 }
80 num2++;
81 if (num2 >= keys.Length)
82 {
83 num2 -= keys.Length;
84 }
85 }
86 return default(V);
87 }
88 set
89 {
90 Table table = m_Table;
91 if (table != null)
92 {
93 int num = 2 * (table.m_count + 1);
94 if (num >= table.m_keys.Length)
95 {
96 Rehash(num);
97 }
98 }
99 else
100 {
101 Rehash(7);
102 }
104 }
105 }
static bool Read(ref bool location)
Definition Volatile.cs:67
static int GetHashCodeHelper(K key)