mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
34 lines
865 B
C#
34 lines
865 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace Cosmos.Core
|
|
{
|
|
// The DataLookupTable (DLT) basically is a linked list.
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
internal unsafe struct DataLookupTable
|
|
{
|
|
public const int EntriesPerTable = 169;
|
|
|
|
[FieldOffset(0)]
|
|
public DataLookupTable* Previous;
|
|
[FieldOffset(4)]
|
|
public DataLookupTable* Next;
|
|
|
|
[FieldOffset(8)]
|
|
public DataLookupEntry FirstEntry;
|
|
|
|
public unsafe DataLookupEntry* GetEntry(int index)
|
|
{
|
|
fixed (DataLookupEntry* xFirstEntryPtr = &FirstEntry)
|
|
{
|
|
if (index == 0)
|
|
{
|
|
return xFirstEntryPtr;
|
|
}
|
|
else
|
|
{
|
|
return &xFirstEntryPtr[index];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|