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