Code: Show/Hide Uint32 IMULHIDWORD(Uint32 A, Uint32 B)
{ Uint32 HDW; #ifdef __GNUC__ //Cyan~Fire: Added GCC-style asm __asm("movl _A, %eax"); __asm("imull _B"); __asm("movl %edx, _HDW"); #else __asm { mov eax, A imul B mov HDW, edx } #endif return HDW; } |
Code: Show/Hide Uint32 IMULHIDWORD(Uint32 A, Uint32 B)
{ unsigned __int64 product; product = (unsigned __int64)A * (unsigned __int64)B; return ((Uint32)(product >> 32)); } |
Code: Show/Hide Uint32 IMULHIDWORD(Uint32 A, Uint32 B)
{ Uint32 HDW; #ifdef __GNUC__ //Cyan~Fire: Added GCC-style asm asm("imull %0" : "=d"(HDW) : "a"(A), "q"(B)); #else __asm { mov eax, A imul B mov HDW, edx } #endif return HDW; } |
Code: Show/Hide #define rep_stosl(value, dest, numwords) \
__asm__ __volatile__ ( \ "cld\n\t" \ "rep\n\t" \ "stosl" \ : : "a" (value), "D" (dest), "c" (numwords) \ : "%ecx", "%edi" ) |
Cyan~Fire wrote: |
Eh, it's easy to read once you understand what it's doing. |
Mr Ekted wrote: |
The point is, the MS version shows you the actual assembly, instruction for instruction. Making a whole new language that hides the operations and their sequences is like using C++. |