Right now I'm working on a project where I'm implementing a VM in D. I'm on the rotate instructions, and realized I could *almost* abstract the ror and rol instructions with the following function

private void rot(string ins)(int *op1, int op2)
{
    int tmp = *op1;
    asm
    {
mov EAX, tmp; // I'd also like to know if I could just load *op1 directly into EAX
        mov ECX, op2[EBP];
        mixin(ins ~ " EAX, CL;"); // Issue here
        mov tmp, EAX;
    }
    *op1 = tmp;
}

However, the inline assembler doesn't like me trying to do a mixin. Is there a way around this?

(There is a reason op1 is a pointer instead of a ref int, please don't ask about it)

Reply via email to