Thanks 4 the code (this goes to Matthias Pleh too):

Both codes work amazingly fine after modifying them a bit to work with DMD1.030.
This helped me a lot!
Still don't know how the asm version implicitly returns a value (no return 
keyword
needed). It seems that the returned value is EAX, not the variable "value". To
return "value", first the content of EAX should be moved to "value", right? (mov
value, EAX;)

I found this site: http://www.swansontec.com/sregisters.html
It helped me to resolve optimal register usage. It also details wich registers 
can
use offsets.

I finally ended with this ASM code:

// I have to rotate every int of an uint[3]. For some reason i can't directly
reference the array pointer so i create a local variable to the function.

void myFunct()
{
    uint* p = myarray.ptr;
    asm
    {
        mov EBX, p;

        mov EAX, [EBX + 4];
        rol EAX, 8;
        mov [EBX + 4], EAX;

        mov EAX, [EBX + 8];
        rol EAX, 16;
        mov [EBX + 8], EAX;

        mov EAX, [EBX + 12];
        rol EAX, 24;
        mov [EBX + 12], EAX;
    }
}

Hope this helps someone else.
Cheers.

Heinz

Reply via email to