18 lines
654 B
C#
18 lines
654 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()
|
|
{
|
|
if ((Code & 0x80) == 0x80)
|
|
return $"<Dynamic ({Code ^ 0x80})>";
|
|
return $"<{OpCode} ({Code})>";
|
|
}
|
|
} |