mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 12:58:39 +00:00
24 lines
No EOL
675 B
C#
24 lines
No EOL
675 B
C#
using System;
|
|
using System.IO;
|
|
|
|
|
|
using CPU = Indy.IL2CPU.Assembler.X86;
|
|
using Indy.IL2CPU.Assembler;
|
|
|
|
namespace Indy.IL2CPU.IL.X86 {
|
|
[OpCode(OpCodeEnum.Sizeof)]
|
|
public class Sizeof: Op {
|
|
private int mTheSize;
|
|
public Sizeof(ILReader aReader, MethodInformation aMethodInfo)
|
|
: base(aReader, aMethodInfo) {
|
|
Type xTypeRef = aReader.OperandValueType;
|
|
if (xTypeRef == null) {
|
|
throw new Exception("Type not found!");}
|
|
Engine.GetTypeFieldInfo(xTypeRef, out mTheSize);
|
|
}
|
|
public override void DoAssemble() {
|
|
new CPU.Pushd("0" + mTheSize.ToString("X") + "h");
|
|
Assembler.StackContents.Push(new StackContent(4, typeof(int)));
|
|
}
|
|
}
|
|
} |