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

◆ IsInstanceOfInterface()

static unsafe object System.Runtime.CompilerServices.CastHelpers.IsInstanceOfInterface ( void * toTypeHnd,
object obj )
inlinestaticprivate

Definition at line 142 of file CastHelpers.cs.

143 {
144 MethodTable* methodTable;
145 nint num;
146 MethodTable** ptr;
147 if (obj != null)
148 {
149 methodTable = RuntimeHelpers.GetMethodTable(obj);
150 num = methodTable->InterfaceCount;
151 if (num == 0)
152 {
153 goto IL_0083;
154 }
155 ptr = methodTable->InterfaceMap;
156 if (num < 4)
157 {
158 goto IL_006c;
159 }
160 while (*ptr != toTypeHnd && ptr[1] != toTypeHnd && ptr[2] != toTypeHnd && ptr[3] != toTypeHnd)
161 {
162 ptr += 4;
163 num -= 4;
164 if (num >= 4)
165 {
166 continue;
167 }
168 goto IL_0069;
169 }
170 }
171 goto IL_008e;
172 IL_006c:
173 while (*ptr != toTypeHnd)
174 {
175 ptr++;
176 num--;
177 if (num > 0)
178 {
179 continue;
180 }
181 goto IL_0083;
182 }
183 goto IL_008e;
184 IL_0083:
185 if (!methodTable->NonTrivialInterfaceCast)
186 {
187 obj = null;
188 goto IL_008e;
189 }
190 return IsInstance_Helper(toTypeHnd, obj);
191 IL_008e:
192 return obj;
193 IL_0069:
194 if (num != 0)
195 {
196 goto IL_006c;
197 }
198 goto IL_0083;
199 }
static unsafe object IsInstance_Helper(void *toTypeHnd, object obj)

References System.Runtime.CompilerServices.RuntimeHelpers.GetMethodTable(), System.Runtime.CompilerServices.MethodTable.InterfaceCount, System.Runtime.CompilerServices.MethodTable.InterfaceMap, System.Runtime.CompilerServices.CastHelpers.IsInstance_Helper(), System.Runtime.CompilerServices.MethodTable.NonTrivialInterfaceCast, and System.obj.