src/stdlib/SDL_stdlib.c
branchSDL-1.3
changeset 1663 11775724e3fe
parent 1662 782fd950bd46
child 1668 4da1ee79c9af
     1.1 --- a/src/stdlib/SDL_stdlib.c	Sun May 28 13:04:16 2006 +0000
     1.2 +++ b/src/stdlib/SDL_stdlib.c	Sun May 28 13:29:03 2006 +0000
     1.3 @@ -42,29 +42,53 @@
     1.4  /* Float to long */
     1.5       void __declspec (naked) _ftol ()
     1.6  {
     1.7 +    /* *INDENT-OFF* */
     1.8      __asm {
     1.9 -        push ebp mov ebp, esp sub esp, 20 h and esp, 0F FFFFFF0h fld st (0)
    1.10 -        fst dword ptr[esp + 18 h]
    1.11 -        fistp qword ptr[esp + 10 h]
    1.12 -        fild qword ptr[esp + 10 h]
    1.13 -        mov edx, dword ptr[esp + 18 h]
    1.14 -        mov eax, dword ptr[esp + 10 h]
    1.15 -        test eax, eax
    1.16 -            je integer_QnaN_or_zero
    1.17 -            arg_is_not_integer_QnaN:fsubp st (1), st
    1.18 -            test edx, edx jns positive fstp dword ptr[esp]
    1.19 -        mov ecx, dword ptr[esp]
    1.20 -        xor ecx, 80000000 h
    1.21 -            add ecx, 7F FFFFFFh adc eax, 0 mov edx, dword ptr[esp + 14 h]
    1.22 -        adc edx, 0 jmp localexit positive:fstp dword ptr[esp]
    1.23 -        mov ecx, dword ptr[esp]
    1.24 -        add ecx, 7F FFFFFFh sbb eax, 0 mov edx, dword ptr[esp + 14 h]
    1.25 -        sbb edx, 0
    1.26 -            jmp localexit integer_QnaN_or_zero:mov edx, dword ptr[esp + 14 h]
    1.27 -        test edx, 7F FFFFFFh
    1.28 -            jne arg_is_not_integer_QnaN fstp dword ptr[esp + 18 h]
    1.29 -    fstp dword ptr[esp + 18 h] localexit:leave ret}
    1.30 +        push        ebp
    1.31 +        mov         ebp,esp
    1.32 +        sub         esp,20h
    1.33 +        and         esp,0FFFFFFF0h
    1.34 +        fld         st(0)
    1.35 +        fst         dword ptr [esp+18h]
    1.36 +        fistp       qword ptr [esp+10h]
    1.37 +        fild        qword ptr [esp+10h]
    1.38 +        mov         edx,dword ptr [esp+18h]
    1.39 +        mov         eax,dword ptr [esp+10h]
    1.40 +        test        eax,eax
    1.41 +        je          integer_QnaN_or_zero
    1.42 +arg_is_not_integer_QnaN:
    1.43 +        fsubp       st(1),st
    1.44 +        test        edx,edx
    1.45 +        jns         positive
    1.46 +        fstp        dword ptr [esp]
    1.47 +        mov         ecx,dword ptr [esp]
    1.48 +        xor         ecx,80000000h
    1.49 +        add         ecx,7FFFFFFFh
    1.50 +        adc         eax,0
    1.51 +        mov         edx,dword ptr [esp+14h]
    1.52 +        adc         edx,0
    1.53 +        jmp         localexit
    1.54 +positive:
    1.55 +        fstp        dword ptr [esp]
    1.56 +        mov         ecx,dword ptr [esp]
    1.57 +        add         ecx,7FFFFFFFh
    1.58 +        sbb         eax,0
    1.59 +        mov         edx,dword ptr [esp+14h]
    1.60 +        sbb         edx,0
    1.61 +        jmp         localexit
    1.62 +integer_QnaN_or_zero:
    1.63 +        mov         edx,dword ptr [esp+14h]
    1.64 +        test        edx,7FFFFFFFh
    1.65 +        jne         arg_is_not_integer_QnaN
    1.66 +        fstp        dword ptr [esp+18h]
    1.67 +        fstp        dword ptr [esp+18h]
    1.68 +localexit:
    1.69 +        leave
    1.70 +        ret
    1.71 +    }
    1.72 +    /* *INDENT-ON* */
    1.73  }
    1.74 +
    1.75  void
    1.76  __declspec (naked)
    1.77  _ftol2_sse ()
    1.78 @@ -77,324 +101,564 @@
    1.79  __declspec (naked)
    1.80  _allmul ()
    1.81  {
    1.82 +    /* *INDENT-OFF* */
    1.83      __asm {
    1.84 -        push ebp
    1.85 -            mov ebp, esp
    1.86 -            push edi
    1.87 -            push esi push ebx sub esp, 0 Ch mov eax, dword ptr[ebp + 10 h]
    1.88 -        mov edi, dword ptr[ebp + 8]
    1.89 -        mov ebx, eax mov esi, eax sar esi, 1F h mov eax, dword ptr[ebp + 8]
    1.90 -        mul ebx
    1.91 -            imul edi, esi
    1.92 -            mov ecx, edx
    1.93 -            mov dword ptr[ebp - 18 h], eax mov edx, dword ptr[ebp + 0 Ch]
    1.94 -        add ecx, edi imul ebx, edx mov eax, dword ptr[ebp - 18 h]
    1.95 -        lea ebx,[ebx + ecx]
    1.96 -        mov dword ptr[ebp - 14 h], ebx mov edx, dword ptr[ebp - 14 h]
    1.97 -    add esp, 0 Ch pop ebx pop esi pop edi pop ebp ret}
    1.98 +        push        ebp
    1.99 +        mov         ebp,esp
   1.100 +        push        edi
   1.101 +        push        esi
   1.102 +        push        ebx
   1.103 +        sub         esp,0Ch
   1.104 +        mov         eax,dword ptr [ebp+10h]
   1.105 +        mov         edi,dword ptr [ebp+8]
   1.106 +        mov         ebx,eax
   1.107 +        mov         esi,eax
   1.108 +        sar         esi,1Fh
   1.109 +        mov         eax,dword ptr [ebp+8]
   1.110 +        mul         ebx
   1.111 +        imul        edi,esi
   1.112 +        mov         ecx,edx
   1.113 +        mov         dword ptr [ebp-18h],eax
   1.114 +        mov         edx,dword ptr [ebp+0Ch]
   1.115 +        add         ecx,edi
   1.116 +        imul        ebx,edx
   1.117 +        mov         eax,dword ptr [ebp-18h]
   1.118 +        lea         ebx,[ebx+ecx]
   1.119 +        mov         dword ptr [ebp-14h],ebx
   1.120 +        mov         edx,dword ptr [ebp-14h]
   1.121 +        add         esp,0Ch
   1.122 +        pop         ebx
   1.123 +        pop         esi
   1.124 +        pop         edi
   1.125 +        pop         ebp
   1.126 +        ret
   1.127 +    }
   1.128 +    /* *INDENT-ON* */
   1.129  }
   1.130  void
   1.131  __declspec (naked)
   1.132  _alldiv ()
   1.133  {
   1.134 +    /* *INDENT-OFF* */
   1.135      __asm {
   1.136 -        push edi push esi push ebx xor edi, edi mov eax, dword ptr[esp + 14 h]
   1.137 -        or eax, eax jge L1 inc edi mov edx, dword ptr[esp + 10 h]
   1.138 -        neg eax
   1.139 -            neg edx
   1.140 -            sbb eax, 0
   1.141 -            mov dword ptr[esp + 14 h], eax
   1.142 -            mov dword ptr[esp + 10 h], edx L1:mov eax, dword ptr[esp + 1 Ch]
   1.143 -        or eax, eax jge L2 inc edi mov edx, dword ptr[esp + 18 h]
   1.144 -        neg eax
   1.145 -            neg edx
   1.146 -            sbb eax, 0
   1.147 -            mov dword ptr[esp + 1 Ch], eax
   1.148 -            mov dword ptr[esp + 18 h], edx
   1.149 -            L2:or eax, eax jne L3 mov ecx, dword ptr[esp + 18 h]
   1.150 -        mov eax, dword ptr[esp + 14 h]
   1.151 -        xor edx, edx div ecx mov ebx, eax mov eax, dword ptr[esp + 10 h]
   1.152 -        div ecx
   1.153 -            mov edx, ebx jmp L4 L3:mov ebx, eax mov ecx, dword ptr[esp + 18 h]
   1.154 -        mov edx, dword ptr[esp + 14 h]
   1.155 -        mov eax, dword ptr[esp + 10 h]
   1.156 -
   1.157 -
   1.158 -
   1.159 -
   1.160 -
   1.161 -
   1.162 -         
   1.163 -            L5:shr ebx, 1
   1.164 -            rcr ecx, 1
   1.165 -            shr edx, 1
   1.166 -            rcr eax, 1
   1.167 -            or ebx, ebx jne L5 div ecx mov esi, eax mul dword ptr[esp + 1 Ch]
   1.168 -        mov ecx, eax mov eax, dword ptr[esp + 18 h]
   1.169 -        mul esi add edx, ecx jb L6 cmp edx, dword ptr[esp + 14 h]
   1.170 -        ja L6 jb L7 cmp eax, dword ptr[esp + 10 h]
   1.171 -    jbe L7
   1.172 -            L6:dec esi
   1.173 -            L7:xor edx, edx
   1.174 -            mov eax, esi
   1.175 -            L4:dec edi
   1.176 -            jne L8
   1.177 -            neg edx neg eax sbb edx, 0 L8:pop ebx pop esi pop edi ret 10 h}
   1.178 +        push        edi
   1.179 +        push        esi
   1.180 +        push        ebx
   1.181 +        xor         edi,edi
   1.182 +        mov         eax,dword ptr [esp+14h]
   1.183 +        or          eax,eax
   1.184 +        jge         L1
   1.185 +        inc         edi
   1.186 +        mov         edx,dword ptr [esp+10h]
   1.187 +        neg         eax
   1.188 +        neg         edx
   1.189 +        sbb         eax,0
   1.190 +        mov         dword ptr [esp+14h],eax
   1.191 +        mov         dword ptr [esp+10h],edx
   1.192 +L1:
   1.193 +        mov         eax,dword ptr [esp+1Ch]
   1.194 +        or          eax,eax
   1.195 +        jge         L2
   1.196 +        inc         edi
   1.197 +        mov         edx,dword ptr [esp+18h]
   1.198 +        neg         eax
   1.199 +        neg         edx
   1.200 +        sbb         eax,0
   1.201 +        mov         dword ptr [esp+1Ch],eax
   1.202 +        mov         dword ptr [esp+18h],edx
   1.203 +L2:
   1.204 +        or          eax,eax
   1.205 +        jne         L3
   1.206 +        mov         ecx,dword ptr [esp+18h]
   1.207 +        mov         eax,dword ptr [esp+14h]
   1.208 +        xor         edx,edx
   1.209 +        div         ecx
   1.210 +        mov         ebx,eax
   1.211 +        mov         eax,dword ptr [esp+10h]
   1.212 +        div         ecx
   1.213 +        mov         edx,ebx
   1.214 +        jmp         L4
   1.215 +L3:
   1.216 +        mov         ebx,eax
   1.217 +        mov         ecx,dword ptr [esp+18h]
   1.218 +        mov         edx,dword ptr [esp+14h]
   1.219 +        mov         eax,dword ptr [esp+10h]
   1.220 +L5:
   1.221 +        shr         ebx,1
   1.222 +        rcr         ecx,1
   1.223 +        shr         edx,1
   1.224 +        rcr         eax,1
   1.225 +        or          ebx,ebx
   1.226 +        jne         L5
   1.227 +        div         ecx
   1.228 +        mov         esi,eax
   1.229 +        mul         dword ptr [esp+1Ch]
   1.230 +        mov         ecx,eax
   1.231 +        mov         eax,dword ptr [esp+18h]
   1.232 +        mul         esi
   1.233 +        add         edx,ecx
   1.234 +        jb          L6
   1.235 +        cmp         edx,dword ptr [esp+14h]
   1.236 +        ja          L6
   1.237 +        jb          L7
   1.238 +        cmp         eax,dword ptr [esp+10h]
   1.239 +        jbe         L7
   1.240 +L6:
   1.241 +        dec         esi
   1.242 +L7:
   1.243 +        xor         edx,edx
   1.244 +        mov         eax,esi
   1.245 +L4:
   1.246 +        dec         edi
   1.247 +        jne         L8
   1.248 +        neg         edx
   1.249 +        neg         eax
   1.250 +        sbb         edx,0
   1.251 +L8:
   1.252 +        pop         ebx
   1.253 +        pop         esi
   1.254 +        pop         edi
   1.255 +        ret         10h
   1.256 +    }
   1.257 +    /* *INDENT-ON* */
   1.258  }
   1.259  void
   1.260  __declspec (naked)
   1.261  _aulldiv ()
   1.262  {
   1.263 +    /* *INDENT-OFF* */
   1.264      __asm {
   1.265 -        push ebx push esi mov eax, dword ptr[esp + 18 h]
   1.266 -        or eax, eax jne L1 mov ecx, dword ptr[esp + 14 h]
   1.267 -        mov eax, dword ptr[esp + 10 h]
   1.268 -        xor edx, edx div ecx mov ebx, eax mov eax, dword ptr[esp + 0 Ch]
   1.269 -        div ecx
   1.270 -            mov edx, ebx jmp L2 L1:mov ecx, eax mov ebx, dword ptr[esp + 14 h]
   1.271 -        mov edx, dword ptr[esp + 10 h]
   1.272 -        mov eax, dword ptr[esp + 0 Ch]
   1.273 -
   1.274 -
   1.275 -
   1.276 -
   1.277 -
   1.278 -
   1.279 -         
   1.280 -            L3:shr ecx, 1
   1.281 -            rcr ebx, 1
   1.282 -            shr edx, 1
   1.283 -            rcr eax, 1
   1.284 -            or ecx, ecx jne L3 div ebx mov esi, eax mul dword ptr[esp + 18 h]
   1.285 -        mov ecx, eax mov eax, dword ptr[esp + 14 h]
   1.286 -        mul esi add edx, ecx jb L4 cmp edx, dword ptr[esp + 10 h]
   1.287 -        ja L4 jb L5 cmp eax, dword ptr[esp + 0 Ch]
   1.288 -    jbe L5
   1.289 -            L4:dec esi
   1.290 -            L5:xor edx, edx mov eax, esi L2:pop esi pop ebx ret 10 h}
   1.291 +        push        ebx
   1.292 +        push        esi
   1.293 +        mov         eax,dword ptr [esp+18h]
   1.294 +        or          eax,eax
   1.295 +        jne         L1
   1.296 +        mov         ecx,dword ptr [esp+14h]
   1.297 +        mov         eax,dword ptr [esp+10h]
   1.298 +        xor         edx,edx
   1.299 +        div         ecx
   1.300 +        mov         ebx,eax
   1.301 +        mov         eax,dword ptr [esp+0Ch]
   1.302 +        div         ecx
   1.303 +        mov         edx,ebx
   1.304 +        jmp         L2
   1.305 +L1:
   1.306 +        mov         ecx,eax
   1.307 +        mov         ebx,dword ptr [esp+14h]
   1.308 +        mov         edx,dword ptr [esp+10h]
   1.309 +        mov         eax,dword ptr [esp+0Ch]
   1.310 +L3:
   1.311 +        shr         ecx,1
   1.312 +        rcr         ebx,1
   1.313 +        shr         edx,1
   1.314 +        rcr         eax,1
   1.315 +        or          ecx,ecx
   1.316 +        jne         L3
   1.317 +        div         ebx
   1.318 +        mov         esi,eax
   1.319 +        mul         dword ptr [esp+18h]
   1.320 +        mov         ecx,eax
   1.321 +        mov         eax,dword ptr [esp+14h]
   1.322 +        mul         esi
   1.323 +        add         edx,ecx
   1.324 +        jb          L4
   1.325 +        cmp         edx,dword ptr [esp+10h]
   1.326 +        ja          L4
   1.327 +        jb          L5
   1.328 +        cmp         eax,dword ptr [esp+0Ch]
   1.329 +        jbe         L5
   1.330 +L4:
   1.331 +        dec         esi
   1.332 +L5:
   1.333 +        xor         edx,edx
   1.334 +        mov         eax,esi
   1.335 +L2:
   1.336 +        pop         esi
   1.337 +        pop         ebx
   1.338 +        ret         10h
   1.339 +    }
   1.340 +    /* *INDENT-ON* */
   1.341  }
   1.342  void
   1.343  __declspec (naked)
   1.344  _allrem ()
   1.345  {
   1.346 +    /* *INDENT-OFF* */
   1.347      __asm {
   1.348 -        push ebx push edi xor edi, edi mov eax, dword ptr[esp + 10 h]
   1.349 -        or eax, eax jge L1 inc edi mov edx, dword ptr[esp + 0 Ch]
   1.350 -        neg eax
   1.351 -            neg edx
   1.352 -            sbb eax, 0
   1.353 -            mov dword ptr[esp + 10 h], eax
   1.354 -            mov dword ptr[esp + 0 Ch], edx L1:mov eax, dword ptr[esp + 18 h]
   1.355 -        or eax, eax jge L2 mov edx, dword ptr[esp + 14 h]
   1.356 -        neg eax
   1.357 -            neg edx
   1.358 -            sbb eax, 0
   1.359 -            mov dword ptr[esp + 18 h], eax
   1.360 -            mov dword ptr[esp + 14 h], edx
   1.361 -            L2:or eax, eax jne L3 mov ecx, dword ptr[esp + 14 h]
   1.362 -        mov eax, dword ptr[esp + 10 h]
   1.363 -        xor edx, edx div ecx mov eax, dword ptr[esp + 0 Ch]
   1.364 -        div ecx
   1.365 -            mov eax, edx
   1.366 -            xor edx, edx
   1.367 -            dec edi
   1.368 -            jns L4 jmp L8 L3:mov ebx, eax mov ecx, dword ptr[esp + 14 h]
   1.369 -        mov edx, dword ptr[esp + 10 h]
   1.370 -        mov eax, dword ptr[esp + 0 Ch]
   1.371 -
   1.372 -
   1.373 -
   1.374 -
   1.375 -
   1.376 -
   1.377 -         
   1.378 -            L5:shr ebx, 1
   1.379 -            rcr ecx, 1
   1.380 -            shr edx, 1
   1.381 -            rcr eax, 1
   1.382 -            or ebx, ebx jne L5 div ecx mov ecx, eax mul dword ptr[esp + 18 h]
   1.383 -        xchg eax, ecx mul dword ptr[esp + 14 h]
   1.384 -        add edx, ecx jb L6 cmp edx, dword ptr[esp + 10 h]
   1.385 -        ja L6 jb L7 cmp eax, dword ptr[esp + 0 Ch]
   1.386 -        jbe L7 L6:sub eax, dword ptr[esp + 14 h]
   1.387 -        sbb edx, dword ptr[esp + 18 h]
   1.388 -          L7:sub eax, dword ptr[esp + 0 Ch]
   1.389 -        sbb edx, dword ptr[esp + 10 h]
   1.390 -    dec edi
   1.391 -            jns L8 L4:neg edx neg eax sbb edx, 0 L8:pop edi pop ebx ret 10 h}
   1.392 +        push        ebx
   1.393 +        push        edi
   1.394 +        xor         edi,edi
   1.395 +        mov         eax,dword ptr [esp+10h]
   1.396 +        or          eax,eax
   1.397 +        jge         L1
   1.398 +        inc         edi
   1.399 +        mov         edx,dword ptr [esp+0Ch]
   1.400 +        neg         eax
   1.401 +        neg         edx
   1.402 +        sbb         eax,0
   1.403 +        mov         dword ptr [esp+10h],eax
   1.404 +        mov         dword ptr [esp+0Ch],edx
   1.405 +L1:
   1.406 +        mov         eax,dword ptr [esp+18h]
   1.407 +        or          eax,eax
   1.408 +        jge         L2
   1.409 +        mov         edx,dword ptr [esp+14h]
   1.410 +        neg         eax
   1.411 +        neg         edx
   1.412 +        sbb         eax,0
   1.413 +        mov         dword ptr [esp+18h],eax
   1.414 +        mov         dword ptr [esp+14h],edx
   1.415 +L2:
   1.416 +        or          eax,eax
   1.417 +        jne         L3
   1.418 +        mov         ecx,dword ptr [esp+14h]
   1.419 +        mov         eax,dword ptr [esp+10h]
   1.420 +        xor         edx,edx
   1.421 +        div         ecx
   1.422 +        mov         eax,dword ptr [esp+0Ch]
   1.423 +        div         ecx
   1.424 +        mov         eax,edx
   1.425 +        xor         edx,edx
   1.426 +        dec         edi
   1.427 +        jns         L4
   1.428 +        jmp         L8
   1.429 +L3:
   1.430 +        mov         ebx,eax
   1.431 +        mov         ecx,dword ptr [esp+14h]
   1.432 +        mov         edx,dword ptr [esp+10h]
   1.433 +        mov         eax,dword ptr [esp+0Ch]
   1.434 +L5:
   1.435 +        shr         ebx,1
   1.436 +        rcr         ecx,1
   1.437 +        shr         edx,1
   1.438 +        rcr         eax,1
   1.439 +        or          ebx,ebx
   1.440 +        jne         L5
   1.441 +        div         ecx
   1.442 +        mov         ecx,eax
   1.443 +        mul         dword ptr [esp+18h]
   1.444 +        xchg        eax,ecx
   1.445 +        mul         dword ptr [esp+14h]
   1.446 +        add         edx,ecx
   1.447 +        jb          L6
   1.448 +        cmp         edx,dword ptr [esp+10h]
   1.449 +        ja          L6
   1.450 +        jb          L7
   1.451 +        cmp         eax,dword ptr [esp+0Ch]
   1.452 +        jbe         L7
   1.453 +L6:
   1.454 +        sub         eax,dword ptr [esp+14h]
   1.455 +        sbb         edx,dword ptr [esp+18h]
   1.456 +L7:
   1.457 +        sub         eax,dword ptr [esp+0Ch]
   1.458 +        sbb         edx,dword ptr [esp+10h]
   1.459 +        dec         edi
   1.460 +        jns         L8
   1.461 +L4:
   1.462 +        neg         edx
   1.463 +        neg         eax
   1.464 +        sbb         edx,0
   1.465 +L8:
   1.466 +        pop         edi
   1.467 +        pop         ebx
   1.468 +        ret         10h
   1.469 +    }
   1.470 +    /* *INDENT-ON* */
   1.471  }
   1.472  void
   1.473  __declspec (naked)
   1.474  _aullrem ()
   1.475  {
   1.476 +    /* *INDENT-OFF* */
   1.477      __asm {
   1.478 -        push ebx mov eax, dword ptr[esp + 14 h]
   1.479 -        or eax, eax jne L1 mov ecx, dword ptr[esp + 10 h]
   1.480 -        mov eax, dword ptr[esp + 0 Ch]
   1.481 -        xor edx, edx div ecx mov eax, dword ptr[esp + 8]
   1.482 -        div ecx
   1.483 -            mov eax, edx
   1.484 -            xor edx, edx jmp L2 L1:mov ecx, eax mov ebx, dword ptr[esp + 10 h]
   1.485 -        mov edx, dword ptr[esp + 0 Ch]
   1.486 -        mov eax, dword ptr[esp + 8]
   1.487 -
   1.488 -
   1.489 -
   1.490 -
   1.491 -
   1.492 -
   1.493 -         
   1.494 -            L3:shr ecx, 1
   1.495 -            rcr ebx, 1
   1.496 -            shr edx, 1
   1.497 -            rcr eax, 1
   1.498 -            or ecx, ecx jne L3 div ebx mov ecx, eax mul dword ptr[esp + 14 h]
   1.499 -        xchg eax, ecx mul dword ptr[esp + 10 h]
   1.500 -        add edx, ecx jb L4 cmp edx, dword ptr[esp + 0 Ch]
   1.501 -        ja L4 jb L5 cmp eax, dword ptr[esp + 8]
   1.502 -        jbe L5 L4:sub eax, dword ptr[esp + 10 h]
   1.503 -        sbb edx, dword ptr[esp + 14 h]
   1.504 -          L5:sub eax, dword ptr[esp + 8]
   1.505 -        sbb edx, dword ptr[esp + 0 Ch]
   1.506 -    neg edx neg eax sbb edx, 0 L2:pop ebx ret 10 h}
   1.507 +        push        ebx
   1.508 +        mov         eax,dword ptr [esp+14h]
   1.509 +        or          eax,eax
   1.510 +        jne         L1
   1.511 +        mov         ecx,dword ptr [esp+10h]
   1.512 +        mov         eax,dword ptr [esp+0Ch]
   1.513 +        xor         edx,edx
   1.514 +        div         ecx
   1.515 +        mov         eax,dword ptr [esp+8]
   1.516 +        div         ecx
   1.517 +        mov         eax,edx
   1.518 +        xor         edx,edx
   1.519 +        jmp         L2
   1.520 +L1:
   1.521 +        mov         ecx,eax
   1.522 +        mov         ebx,dword ptr [esp+10h]
   1.523 +        mov         edx,dword ptr [esp+0Ch]
   1.524 +        mov         eax,dword ptr [esp+8]
   1.525 +L3:
   1.526 +        shr         ecx,1
   1.527 +        rcr         ebx,1
   1.528 +        shr         edx,1
   1.529 +        rcr         eax,1
   1.530 +        or          ecx,ecx
   1.531 +        jne         L3
   1.532 +        div         ebx
   1.533 +        mov         ecx,eax
   1.534 +        mul         dword ptr [esp+14h]
   1.535 +        xchg        eax,ecx
   1.536 +        mul         dword ptr [esp+10h]
   1.537 +        add         edx,ecx
   1.538 +        jb          L4
   1.539 +        cmp         edx,dword ptr [esp+0Ch]
   1.540 +        ja          L4
   1.541 +        jb          L5
   1.542 +        cmp         eax,dword ptr [esp+8]
   1.543 +        jbe         L5
   1.544 +L4:
   1.545 +        sub         eax,dword ptr [esp+10h]
   1.546 +        sbb         edx,dword ptr [esp+14h]
   1.547 +L5:
   1.548 +        sub         eax,dword ptr [esp+8]
   1.549 +        sbb         edx,dword ptr [esp+0Ch]
   1.550 +        neg         edx
   1.551 +        neg         eax
   1.552 +        sbb         edx,0
   1.553 +L2:
   1.554 +        pop         ebx
   1.555 +        ret         10h
   1.556 +    }
   1.557 +    /* *INDENT-ON* */
   1.558  }
   1.559  void
   1.560  __declspec (naked)
   1.561  _alldvrm ()
   1.562  {
   1.563 +    /* *INDENT-OFF* */
   1.564      __asm {
   1.565 -        push edi
   1.566 -            push esi
   1.567 -            push ebp xor edi, edi xor ebp, ebp mov eax, dword ptr[esp + 14 h]
   1.568 -        or eax, eax jge L1 inc edi inc ebp mov edx, dword ptr[esp + 10 h]
   1.569 -        neg eax
   1.570 -            neg edx
   1.571 -            sbb eax, 0
   1.572 -            mov dword ptr[esp + 14 h], eax
   1.573 -            mov dword ptr[esp + 10 h], edx L1:mov eax, dword ptr[esp + 1 Ch]
   1.574 -        or eax, eax jge L2 inc edi mov edx, dword ptr[esp + 18 h]
   1.575 -        neg eax
   1.576 -            neg edx
   1.577 -            sbb eax, 0
   1.578 -            mov dword ptr[esp + 1 Ch], eax
   1.579 -            mov dword ptr[esp + 18 h], edx
   1.580 -            L2:or eax, eax jne L3 mov ecx, dword ptr[esp + 18 h]
   1.581 -        mov eax, dword ptr[esp + 14 h]
   1.582 -        xor edx, edx div ecx mov ebx, eax mov eax, dword ptr[esp + 10 h]
   1.583 -        div ecx mov esi, eax mov eax, ebx mul dword ptr[esp + 18 h]
   1.584 -        mov ecx, eax mov eax, esi mul dword ptr[esp + 18 h]
   1.585 -        add edx, ecx jmp L4 L3:mov ebx, eax mov ecx, dword ptr[esp + 18 h]
   1.586 -        mov edx, dword ptr[esp + 14 h]
   1.587 -        mov eax, dword ptr[esp + 10 h]
   1.588 -
   1.589 -
   1.590 -
   1.591 -
   1.592 -
   1.593 -
   1.594 -         
   1.595 -            L5:shr ebx, 1
   1.596 -            rcr ecx, 1
   1.597 -            shr edx, 1
   1.598 -            rcr eax, 1
   1.599 -            or ebx, ebx jne L5 div ecx mov esi, eax mul dword ptr[esp + 1 Ch]
   1.600 -        mov ecx, eax mov eax, dword ptr[esp + 18 h]
   1.601 -        mul esi add edx, ecx jb L6 cmp edx, dword ptr[esp + 14 h]
   1.602 -        ja L6 jb L7 cmp eax, dword ptr[esp + 10 h]
   1.603 -        jbe L7 L6:dec esi sub eax, dword ptr[esp + 18 h]
   1.604 -        sbb edx, dword ptr[esp + 1 Ch]
   1.605 -          L7:xor ebx, ebx L4:sub eax, dword ptr[esp + 10 h]
   1.606 -        sbb edx, dword ptr[esp + 14 h]
   1.607 -    dec ebp
   1.608 -            jns L9
   1.609 -            neg edx
   1.610 -            neg eax
   1.611 -            sbb edx, 0
   1.612 -            L9:mov ecx, edx
   1.613 -            mov edx, ebx
   1.614 -            mov ebx, ecx
   1.615 -            mov ecx, eax
   1.616 -            mov eax, esi
   1.617 -            dec edi
   1.618 -            jne L8
   1.619 -            neg edx neg eax sbb edx, 0 L8:pop ebp pop esi pop edi ret 10 h}
   1.620 +        push        edi
   1.621 +        push        esi
   1.622 +        push        ebp
   1.623 +        xor         edi,edi
   1.624 +        xor         ebp,ebp
   1.625 +        mov         eax,dword ptr [esp+14h]
   1.626 +        or          eax,eax
   1.627 +        jge         L1
   1.628 +        inc         edi
   1.629 +        inc         ebp
   1.630 +        mov         edx,dword ptr [esp+10h]
   1.631 +        neg         eax
   1.632 +        neg         edx
   1.633 +        sbb         eax,0
   1.634 +        mov         dword ptr [esp+14h],eax
   1.635 +        mov         dword ptr [esp+10h],edx
   1.636 +L1:
   1.637 +        mov         eax,dword ptr [esp+1Ch]
   1.638 +        or          eax,eax
   1.639 +        jge         L2
   1.640 +        inc         edi
   1.641 +        mov         edx,dword ptr [esp+18h]
   1.642 +        neg         eax
   1.643 +        neg         edx
   1.644 +        sbb         eax,0
   1.645 +        mov         dword ptr [esp+1Ch],eax
   1.646 +        mov         dword ptr [esp+18h],edx
   1.647 +L2:
   1.648 +        or          eax,eax
   1.649 +        jne         L3
   1.650 +        mov         ecx,dword ptr [esp+18h]
   1.651 +        mov         eax,dword ptr [esp+14h]
   1.652 +        xor         edx,edx
   1.653 +        div         ecx
   1.654 +        mov         ebx,eax
   1.655 +        mov         eax,dword ptr [esp+10h]
   1.656 +        div         ecx
   1.657 +        mov         esi,eax
   1.658 +        mov         eax,ebx
   1.659 +        mul         dword ptr [esp+18h]
   1.660 +        mov         ecx,eax
   1.661 +        mov         eax,esi
   1.662 +        mul         dword ptr [esp+18h]
   1.663 +        add         edx,ecx
   1.664 +        jmp         L4
   1.665 +L3:
   1.666 +        mov         ebx,eax
   1.667 +        mov         ecx,dword ptr [esp+18h]
   1.668 +        mov         edx,dword ptr [esp+14h]
   1.669 +        mov         eax,dword ptr [esp+10h]
   1.670 +L5:
   1.671 +        shr         ebx,1
   1.672 +        rcr         ecx,1
   1.673 +        shr         edx,1
   1.674 +        rcr         eax,1
   1.675 +        or          ebx,ebx
   1.676 +        jne         L5
   1.677 +        div         ecx
   1.678 +        mov         esi,eax
   1.679 +        mul         dword ptr [esp+1Ch]
   1.680 +        mov         ecx,eax
   1.681 +        mov         eax,dword ptr [esp+18h]
   1.682 +        mul         esi
   1.683 +        add         edx,ecx
   1.684 +        jb          L6
   1.685 +        cmp         edx,dword ptr [esp+14h]
   1.686 +        ja          L6
   1.687 +        jb          L7
   1.688 +        cmp         eax,dword ptr [esp+10h]
   1.689 +        jbe         L7
   1.690 +L6:
   1.691 +        dec         esi
   1.692 +        sub         eax,dword ptr [esp+18h]
   1.693 +        sbb         edx,dword ptr [esp+1Ch]
   1.694 +L7:
   1.695 +        xor         ebx,ebx
   1.696 +L4:
   1.697 +        sub         eax,dword ptr [esp+10h]
   1.698 +        sbb         edx,dword ptr [esp+14h]
   1.699 +        dec         ebp
   1.700 +        jns         L9
   1.701 +        neg         edx
   1.702 +        neg         eax
   1.703 +        sbb         edx,0
   1.704 +L9:
   1.705 +        mov         ecx,edx
   1.706 +        mov         edx,ebx
   1.707 +        mov         ebx,ecx
   1.708 +        mov         ecx,eax
   1.709 +        mov         eax,esi
   1.710 +        dec         edi
   1.711 +        jne         L8
   1.712 +        neg         edx
   1.713 +        neg         eax
   1.714 +        sbb         edx,0
   1.715 +L8:
   1.716 +        pop         ebp
   1.717 +        pop         esi
   1.718 +        pop         edi
   1.719 +        ret         10h
   1.720 +    }
   1.721 +    /* *INDENT-ON* */
   1.722  }
   1.723  void
   1.724  __declspec (naked)
   1.725  _aulldvrm ()
   1.726  {
   1.727 +    /* *INDENT-OFF* */
   1.728      __asm {
   1.729 -        push esi mov eax, dword ptr[esp + 14 h]
   1.730 -        or eax, eax jne L1 mov ecx, dword ptr[esp + 10 h]
   1.731 -        mov eax, dword ptr[esp + 0 Ch]
   1.732 -        xor edx, edx div ecx mov ebx, eax mov eax, dword ptr[esp + 8]
   1.733 -        div ecx mov esi, eax mov eax, ebx mul dword ptr[esp + 10 h]
   1.734 -        mov ecx, eax mov eax, esi mul dword ptr[esp + 10 h]
   1.735 -        add edx, ecx jmp L2 L1:mov ecx, eax mov ebx, dword ptr[esp + 10 h]
   1.736 -        mov edx, dword ptr[esp + 0 Ch]
   1.737 -        mov eax, dword ptr[esp + 8]
   1.738 -
   1.739 -
   1.740 -
   1.741 -
   1.742 -
   1.743 -
   1.744 -         
   1.745 -            L3:shr ecx, 1
   1.746 -            rcr ebx, 1
   1.747 -            shr edx, 1
   1.748 -            rcr eax, 1
   1.749 -            or ecx, ecx jne L3 div ebx mov esi, eax mul dword ptr[esp + 14 h]
   1.750 -        mov ecx, eax mov eax, dword ptr[esp + 10 h]
   1.751 -        mul esi add edx, ecx jb L4 cmp edx, dword ptr[esp + 0 Ch]
   1.752 -        ja L4 jb L5 cmp eax, dword ptr[esp + 8]
   1.753 -        jbe L5 L4:dec esi sub eax, dword ptr[esp + 10 h]
   1.754 -        sbb edx, dword ptr[esp + 14 h]
   1.755 -          L5:xor ebx, ebx L2:sub eax, dword ptr[esp + 8]
   1.756 -        sbb edx, dword ptr[esp + 0 Ch]
   1.757 -    neg edx
   1.758 -            neg eax
   1.759 -            sbb edx, 0
   1.760 -            mov ecx, edx
   1.761 -            mov edx, ebx
   1.762 -            mov ebx, ecx mov ecx, eax mov eax, esi pop esi ret 10 h}
   1.763 +        push        esi
   1.764 +        mov         eax,dword ptr [esp+14h]
   1.765 +        or          eax,eax
   1.766 +        jne         L1
   1.767 +        mov         ecx,dword ptr [esp+10h]
   1.768 +        mov         eax,dword ptr [esp+0Ch]
   1.769 +        xor         edx,edx
   1.770 +        div         ecx
   1.771 +        mov         ebx,eax
   1.772 +        mov         eax,dword ptr [esp+8]
   1.773 +        div         ecx
   1.774 +        mov         esi,eax
   1.775 +        mov         eax,ebx
   1.776 +        mul         dword ptr [esp+10h]
   1.777 +        mov         ecx,eax
   1.778 +        mov         eax,esi
   1.779 +        mul         dword ptr [esp+10h]
   1.780 +        add         edx,ecx
   1.781 +        jmp         L2
   1.782 +L1:
   1.783 +        mov         ecx,eax
   1.784 +        mov         ebx,dword ptr [esp+10h]
   1.785 +        mov         edx,dword ptr [esp+0Ch]
   1.786 +        mov         eax,dword ptr [esp+8]
   1.787 +L3:
   1.788 +        shr         ecx,1
   1.789 +        rcr         ebx,1
   1.790 +        shr         edx,1
   1.791 +        rcr         eax,1
   1.792 +        or          ecx,ecx
   1.793 +        jne         L3
   1.794 +        div         ebx
   1.795 +        mov         esi,eax
   1.796 +        mul         dword ptr [esp+14h]
   1.797 +        mov         ecx,eax
   1.798 +        mov         eax,dword ptr [esp+10h]
   1.799 +        mul         esi
   1.800 +        add         edx,ecx
   1.801 +        jb          L4
   1.802 +        cmp         edx,dword ptr [esp+0Ch]
   1.803 +        ja          L4
   1.804 +        jb          L5
   1.805 +        cmp         eax,dword ptr [esp+8]
   1.806 +        jbe         L5
   1.807 +L4:
   1.808 +        dec         esi
   1.809 +        sub         eax,dword ptr [esp+10h]
   1.810 +        sbb         edx,dword ptr [esp+14h]
   1.811 +L5:
   1.812 +        xor         ebx,ebx
   1.813 +L2:
   1.814 +        sub         eax,dword ptr [esp+8]
   1.815 +        sbb         edx,dword ptr [esp+0Ch]
   1.816 +        neg         edx
   1.817 +        neg         eax
   1.818 +        sbb         edx,0
   1.819 +        mov         ecx,edx
   1.820 +        mov         edx,ebx
   1.821 +        mov         ebx,ecx
   1.822 +        mov         ecx,eax
   1.823 +        mov         eax,esi
   1.824 +        pop         esi
   1.825 +        ret         10h
   1.826 +    }
   1.827 +    /* *INDENT-ON* */
   1.828  }
   1.829  void
   1.830  __declspec (naked)
   1.831  _allshl ()
   1.832  {
   1.833 +    /* *INDENT-OFF* */
   1.834      __asm {
   1.835 -    cmp cl, 40 h
   1.836 -            jae RETZERO
   1.837 -            cmp cl, 20 h
   1.838 -            jae MORE32
   1.839 -            shld edx, eax, cl
   1.840 -            shl eax, cl
   1.841 -            ret
   1.842 -            MORE32:mov edx, eax
   1.843 -            xor eax, eax
   1.844 -            and cl, 1F h
   1.845 -            shl edx, cl ret RETZERO:xor eax, eax xor edx, edx ret}
   1.846 +        cmp         cl,40h
   1.847 +        jae         RETZERO
   1.848 +        cmp         cl,20h
   1.849 +        jae         MORE32
   1.850 +        shld        edx,eax,cl
   1.851 +        shl         eax,cl
   1.852 +        ret
   1.853 +MORE32:
   1.854 +        mov         edx,eax
   1.855 +        xor         eax,eax
   1.856 +        and         cl,1Fh
   1.857 +        shl         edx,cl
   1.858 +        ret
   1.859 +RETZERO:
   1.860 +        xor         eax,eax
   1.861 +        xor         edx,edx
   1.862 +        ret
   1.863 +    }
   1.864 +    /* *INDENT-ON* */
   1.865  }
   1.866  void
   1.867  __declspec (naked)
   1.868  _aullshr ()
   1.869  {
   1.870 +    /* *INDENT-OFF* */
   1.871      __asm {
   1.872 -    cmp cl, 40 h
   1.873 -            jae RETZERO
   1.874 -            cmp cl, 20 h
   1.875 -            jae MORE32
   1.876 -            shrd eax, edx, cl
   1.877 -            shr edx, cl
   1.878 -            ret
   1.879 -            MORE32:mov eax, edx
   1.880 -            xor edx, edx
   1.881 -            and cl, 1F h
   1.882 -            shr eax, cl ret RETZERO:xor eax, eax xor edx, edx ret}
   1.883 +        cmp         cl,40h
   1.884 +        jae         RETZERO
   1.885 +        cmp         cl,20h
   1.886 +        jae         MORE32
   1.887 +        shrd        eax,edx,cl
   1.888 +        shr         edx,cl
   1.889 +        ret
   1.890 +MORE32:
   1.891 +        mov         eax,edx
   1.892 +        xor         edx,edx
   1.893 +        and         cl,1Fh
   1.894 +        shr         eax,cl
   1.895 +        ret
   1.896 +RETZERO:
   1.897 +        xor         eax,eax
   1.898 +        xor         edx,edx
   1.899 +        ret
   1.900 +    }
   1.901 +    /* *INDENT-ON* */
   1.902  }
   1.903  
   1.904 -#endif                          /* MSC_VER */
   1.905 +#endif /* MSC_VER */
   1.906  
   1.907 -#endif                          /* !HAVE_LIBC */
   1.908 +#endif /* !HAVE_LIBC */
   1.909 +
   1.910  /* vi: set ts=4 sw=4 expandtab: */