src/stdlib/SDL_stdlib.c
changeset 10587 513f0e80a7dd
parent 10550 d8a72d273dd2
child 10737 3406a0f8b041
     1.1 --- a/src/stdlib/SDL_stdlib.c	Sun Nov 06 09:30:06 2016 -0800
     1.2 +++ b/src/stdlib/SDL_stdlib.c	Sun Nov 06 10:01:08 2016 -0800
     1.3 @@ -375,35 +375,35 @@
     1.4      _ftol();
     1.5  }
     1.6  
     1.7 -/* 64-bit math operators for 32-bit systems */
     1.8 -void
     1.9 -__declspec(naked)
    1.10 -_allmul()
    1.11 -{
    1.12 -    /* *INDENT-OFF* */
    1.13 -    __asm {
    1.14 -        mov         eax, dword ptr[esp+8]
    1.15 -        mov         ecx, dword ptr[esp+10h]
    1.16 -        or          ecx, eax
    1.17 -        mov         ecx, dword ptr[esp+0Ch]
    1.18 -        jne         hard
    1.19 -        mov         eax, dword ptr[esp+4]
    1.20 -        mul         ecx
    1.21 -        ret         10h
    1.22 -hard:
    1.23 -        push        ebx
    1.24 -        mul         ecx
    1.25 -        mov         ebx, eax
    1.26 -        mov         eax, dword ptr[esp+8]
    1.27 -        mul         dword ptr[esp+14h]
    1.28 -        add         ebx, eax
    1.29 -        mov         eax, dword ptr[esp+8]
    1.30 -        mul         ecx
    1.31 -        add         edx, ebx
    1.32 -        pop         ebx
    1.33 -        ret         10h
    1.34 -    }
    1.35 -    /* *INDENT-ON* */
    1.36 +/* 64-bit math operators for 32-bit systems */
    1.37 +void
    1.38 +__declspec(naked)
    1.39 +_allmul()
    1.40 +{
    1.41 +    /* *INDENT-OFF* */
    1.42 +    __asm {
    1.43 +        mov         eax, dword ptr[esp+8]
    1.44 +        mov         ecx, dword ptr[esp+10h]
    1.45 +        or          ecx, eax
    1.46 +        mov         ecx, dword ptr[esp+0Ch]
    1.47 +        jne         hard
    1.48 +        mov         eax, dword ptr[esp+4]
    1.49 +        mul         ecx
    1.50 +        ret         10h
    1.51 +hard:
    1.52 +        push        ebx
    1.53 +        mul         ecx
    1.54 +        mov         ebx, eax
    1.55 +        mov         eax, dword ptr[esp+8]
    1.56 +        mul         dword ptr[esp+14h]
    1.57 +        add         ebx, eax
    1.58 +        mov         eax, dword ptr[esp+8]
    1.59 +        mul         ecx
    1.60 +        add         edx, ebx
    1.61 +        pop         ebx
    1.62 +        ret         10h
    1.63 +    }
    1.64 +    /* *INDENT-ON* */
    1.65  }
    1.66  
    1.67  void
    1.68 @@ -914,8 +914,8 @@
    1.69  {
    1.70      /* *INDENT-OFF* */
    1.71      __asm {
    1.72 -        cmp         cl,40h
    1.73 -        jae         RETZERO
    1.74 +        cmp         cl,3Fh
    1.75 +        jae         RETSIGN
    1.76          cmp         cl,20h
    1.77          jae         MORE32
    1.78          shrd        eax,edx,cl
    1.79 @@ -923,13 +923,13 @@
    1.80          ret
    1.81  MORE32:
    1.82          mov         eax,edx
    1.83 -        xor         edx,edx
    1.84 +        sar         edx,1Fh
    1.85          and         cl,1Fh
    1.86          sar         eax,cl
    1.87          ret
    1.88 -RETZERO:
    1.89 -        xor         eax,eax
    1.90 -        xor         edx,edx
    1.91 +RETSIGN:
    1.92 +        sar         edx,1Fh
    1.93 +        mov         eax,edx
    1.94          ret
    1.95      }
    1.96      /* *INDENT-ON* */