inline asm return values

Dave Jones dave at jones.com
Sun Mar 25 10:58:37 UTC 2018


Given this...

int mulDiv64(int a, int b, int c)
{
     asm
     {
         mov    EAX,a;
         imul   b;
         idiv   c;
     }
}

which computes a*b/c, with the intermediate value in 64 bit. It 
returns value that is left in EAX.

Is this stuff documented somewhere? I mean I found the page on 
inline asm but it's pretty sparse. I'm porting code from C++ and 
tested it so it works, but it'd be nice to be able to look up the 
rules on how to do return values with asm without having to dump 
it to the stack and then return that.

Is the inline asm portable between compilers?


More information about the Digitalmars-d-learn mailing list