tlang-runtime-compiler/TLang.Common/PushDouble.cs

30 lines
655 B
C#

using System;
using System.IO;
using TLang.Common;
namespace TLang.BytecodeCompiler
{
public class PushDoubleInstruction : Instruction
{
public double Value {get;set;}
public PushDoubleInstruction(double value)
{
Value = value;
}
public override int CalculateLength()
{
return 9;
}
public override void WriteData(Stream strm)
{
strm.WriteByte(PUSH_DOUBLE);
var data=BitConverter.GetBytes(Value);
if(BitConverter.IsLittleEndian) Array.Reverse(data);
strm.Write(data,0,data.Length);
}
}
}