-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathVTable.cs
42 lines (36 loc) · 1.16 KB
/
VTable.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* PROJECT: Atomix Development
* LICENSE: BSD 3-Clause (LICENSE.md)
* PURPOSE: Virtual Table Get Entry Implementation
* PROGRAMMERS: Aman Priyadarshi ([email protected])
*/
using System;
using Atomixilc.Attributes;
namespace Atomixilc.Lib
{
internal class VTable
{
[Label(Helper.VTable_Label)]
internal static unsafe int GetEntry(int* FlushTable, int MethodUID, int TypeID)
{
while(*FlushTable != 0)
{
var xUID = *(FlushTable + 1);
if (xUID == MethodUID)
{
FlushTable += 2;
while(*FlushTable != 0)
{
var xTypeID = *(FlushTable + 1);
if (xTypeID == TypeID)
return *FlushTable;
FlushTable += 2;
}
throw new Exception("virtual method not found");
}
FlushTable += *FlushTable;
}
throw new Exception("virtual method not found");
}
}
}