Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to create Instructions without the appropriate operand type #932

Open
slxdy opened this issue Feb 4, 2024 · 1 comment

Comments

@slxdy
Copy link

slxdy commented Feb 4, 2024

Because this isn't currently possible, cloning instructions or pre-making instructions before assigning their operator is hell.
It's an unnecessary limitation that simply shouldn't exist.

@slxdy
Copy link
Author

slxdy commented Feb 4, 2024

My current workaround (not really safe):

public static Instruction CreateInstructionRaw(OpCode opCode, object? operand = null)
{
    var instruction = (Instruction)RuntimeHelpers.GetUninitializedObject(typeof(Instruction));
    instruction.OpCode = opCode;
    instruction.Operand = operand;
    return instruction;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant