mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-10 10:11:31 +00:00
30 lines
726 B
C#
30 lines
726 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Indy.IL2CPU {
|
|
public static class VTablesImpl {
|
|
public struct VTable {
|
|
public int TypeIdentifier;
|
|
public int BaseTypeIdentifier;
|
|
public int[] MethodIndexes;
|
|
public int[] MethodAddresses;
|
|
}
|
|
|
|
private static VTable[] mTypes;
|
|
public static bool IsInstance(int aObjectType, int aDesiredObjectType) {
|
|
int xCurrentType = aObjectType;
|
|
if (aObjectType == 0) {
|
|
return true;
|
|
}
|
|
do {
|
|
if (xCurrentType == aDesiredObjectType) {
|
|
return true;
|
|
}
|
|
xCurrentType = mTypes[xCurrentType].BaseTypeIdentifier;
|
|
} while (xCurrentType != 0);
|
|
return false;
|
|
}
|
|
}
|
|
}
|