mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
22 lines
No EOL
523 B
C#
22 lines
No EOL
523 B
C#
using System;
|
|
using System.Linq;
|
|
using Mono.Cecil;
|
|
|
|
namespace Indy.IL2CPU {
|
|
public static class ObjectUtilities {
|
|
public static uint GetObjectStorageSize(TypeDefinition aType) {
|
|
uint xResult = ObjectImpl.FieldDataOffset;
|
|
foreach (FieldDefinition xField in aType.Fields) {
|
|
if (xField.IsStatic) {
|
|
continue;
|
|
}
|
|
if (!xField.FieldType.IsValueType) {
|
|
xResult += 4;
|
|
} else {
|
|
xResult += Engine.GetFieldStorageSize(xField.FieldType);
|
|
}
|
|
}
|
|
return xResult;
|
|
}
|
|
}
|
|
} |