divmod assembly implementation

Sam Ludacis samludacis at mail.com
Sat Nov 23 19:54:36 UTC 2024


G'day

I'm trying to implement the Python divmod function in D w/ 
assembly. Should look something like this...

     '''
     ulong divmod64(ulong a, ulong b, ulong quot, ulong rem)
     {
         asm {
             xor RDX, RDX;
             mov RAX, a;
             div b;
             mov quot, RAX;
             mov rem, RDX;
         }
     }
     '''

Without doubt this routine will fail. But would anyone have a way?


More information about the Digitalmars-d-learn mailing list