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

30 lines
655 B
C#
Raw Normal View History

2023-07-29 00:11:09 +00:00
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);
}
}
}