qamp/Qrakhen.Qamp.Core/Execution/Instruction.cs

16 lines
573 B
C#

namespace Qrakhen.Qamp.Core.Execution;
public readonly record struct Instruction(byte Code)
{
public OpCode OpCode => (OpCode)Code;
public static implicit operator byte(Instruction instruction) => instruction.Code;
public static implicit operator Instruction(byte code) => new(code);
public static implicit operator OpCode(Instruction instruction) => (OpCode)instruction.Code;
public static implicit operator Instruction(OpCode code) => new((byte)code);
public override string ToString()
{
return $"<{Code:X4} | {OpCode}>";
}
}