www.pudn.com > CiperLib_release_by_csk.rar > mrmuldv.cpp


/* 
 *  Borland C++ 32-bit compiler (BCC32). Use with mirdef.h32  
 *  Uses inline assembly feature. Suitable for Win32 Apps 
 *  Also compatible with Microsoft Visual C++ 32-bit compiler 
 */ 
 
#include "inner_support.h" 
 
int muldiv(int a, int b,int c,int m,int *rp) 
{ 
    __asm{ 
         mov   eax,DWORD PTR a       
         mul   DWORD PTR b           
         add   eax,DWORD PTR c       
         adc   edx,0h                  
         div   DWORD PTR m           
         mov   ebx,DWORD PTR rp      
         mov   [ebx],edx    
    } 
} 
 
int muldvm(int a,int c,int m,int *rp) 
{ 
     __asm{ 
         mov   edx,DWORD PTR a       
         mov   eax,DWORD PTR c       
         div   DWORD PTR m           
         mov   ebx,DWORD PTR rp      
         mov   [ebx],edx    
     } 
} 
 
int muldvd(int a,int b,int c,int *rp) 
{ 
    __asm{ 
         mov   eax,DWORD PTR a       
         mul   DWORD PTR b           
         add   eax,DWORD PTR c       
         adc   edx,0h                  
         mov   ebx,DWORD PTR rp      
         mov   [ebx],eax               
         mov   eax,edx 
    } 
} 
 
void muldvd2(int a, int b,int *c,int *rp) 
{ 
    __asm{ 
         mov   eax,DWORD PTR a       
         mul   DWORD PTR b           
         mov   ebx,DWORD PTR c 
         add   eax,[ebx] 
         adc   edx,0h 
         mov   esi,DWORD PTR rp 
         add   eax,[esi] 
         adc   edx,0h 
         mov   [esi],eax               
         mov   [ebx],edx 
    } 
}