Mixin in Inline Assembly
Chris M. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 8 18:31:42 PST 2017
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)
More information about the Digitalmars-d-learn
mailing list