Access 'this' in inline assembly
Martin Kinkelin
noone at spam.com
Mon Mar 7 07:14:42 PST 2011
Hi, sorry for the dumb question, but how do i get the address of an object
inside a member function in inline assembly?
I have no experience with assembler yet. It seems like names of variables on
the stack are treated as pointers in inline assembly, but I have no clue about
how to get the address of the object itself (this and [this] do not work).
struct float4
{
float[4] _data;
float dot(in float4 rhs) const
{
float r = void;
asm
{
movups XMM0, this; // need pointer to _data
movups XMM1, rhs;
...
movss r, XMM0;
}
return r;
}
}
Please note that even this doesn't work:
float* ptr = cast(float*) _data.ptr;
asm { movups XMM0, ptr; }
=> 2 operands found for movups instead of the expected 1
More information about the Digitalmars-d-learn
mailing list