Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ ChkCastInterface()

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

Definition at line 299 of file CastHelpers.cs.

300 {
301 nint num;
302 MethodTable** ptr;
303 if (obj != null)
304 {
305 MethodTable* methodTable = RuntimeHelpers.GetMethodTable(obj);
306 num = methodTable->InterfaceCount;
307 if (num == 0)
308 {
309 goto IL_0084;
310 }
311 ptr = methodTable->InterfaceMap;
312 if (num < 4)
313 {
314 goto IL_0069;
315 }
316 while (*ptr != toTypeHnd && ptr[1] != toTypeHnd && ptr[2] != toTypeHnd && ptr[3] != toTypeHnd)
317 {
318 ptr += 4;
319 num -= 4;
320 if (num >= 4)
321 {
322 continue;
323 }
324 goto IL_0066;
325 }
326 }
327 goto IL_0082;
328 IL_0082:
329 return obj;
330 IL_0069:
331 while (*ptr != toTypeHnd)
332 {
333 ptr++;
334 num--;
335 if (num > 0)
336 {
337 continue;
338 }
339 goto IL_0084;
340 }
341 goto IL_0082;
342 IL_0066:
343 if (num != 0)
344 {
345 goto IL_0069;
346 }
347 goto IL_0084;
348 IL_0084:
349 return ChkCast_Helper(toTypeHnd, obj);
350 }
static unsafe object ChkCast_Helper(void *toTypeHnd, object obj)

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