comparison src/stdlib/SDL_stdlib.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents bb6839704ed6
children e1da92da346c
comparison
equal deleted inserted replaced
1894:c69cee13dd76 1895:c121d94672cb
31 #if defined(_MSC_VER) 31 #if defined(_MSC_VER)
32 32
33 #ifndef __FLTUSED__ 33 #ifndef __FLTUSED__
34 #define __FLTUSED__ 34 #define __FLTUSED__
35 #ifdef __cplusplus 35 #ifdef __cplusplus
36 extern "C" 36 extern "C"
37 #endif 37 #endif
38 __declspec(selectany) int _fltused=1; 38 __declspec(selectany)
39 int _fltused = 1;
39 #endif 40 #endif
40 41
41 /* Float to long */ 42 /* Float to long */
42 void __declspec(naked) _ftol() 43 void __declspec(naked) _ftol()
43 { 44 {
44 __asm { 45 /* *INDENT-OFF* */
45 push ebp 46 __asm {
46 mov ebp,esp 47 push ebp
47 sub esp,20h 48 mov ebp,esp
48 and esp,0FFFFFFF0h 49 sub esp,20h
49 fld st(0) 50 and esp,0FFFFFFF0h
50 fst dword ptr [esp+18h] 51 fld st(0)
51 fistp qword ptr [esp+10h] 52 fst dword ptr [esp+18h]
52 fild qword ptr [esp+10h] 53 fistp qword ptr [esp+10h]
53 mov edx,dword ptr [esp+18h] 54 fild qword ptr [esp+10h]
54 mov eax,dword ptr [esp+10h] 55 mov edx,dword ptr [esp+18h]
55 test eax,eax 56 mov eax,dword ptr [esp+10h]
56 je integer_QnaN_or_zero 57 test eax,eax
58 je integer_QnaN_or_zero
57 arg_is_not_integer_QnaN: 59 arg_is_not_integer_QnaN:
58 fsubp st(1),st 60 fsubp st(1),st
59 test edx,edx 61 test edx,edx
60 jns positive 62 jns positive
61 fstp dword ptr [esp] 63 fstp dword ptr [esp]
62 mov ecx,dword ptr [esp] 64 mov ecx,dword ptr [esp]
63 xor ecx,80000000h 65 xor ecx,80000000h
64 add ecx,7FFFFFFFh 66 add ecx,7FFFFFFFh
65 adc eax,0 67 adc eax,0
66 mov edx,dword ptr [esp+14h] 68 mov edx,dword ptr [esp+14h]
67 adc edx,0 69 adc edx,0
68 jmp localexit 70 jmp localexit
69 positive: 71 positive:
70 fstp dword ptr [esp] 72 fstp dword ptr [esp]
71 mov ecx,dword ptr [esp] 73 mov ecx,dword ptr [esp]
72 add ecx,7FFFFFFFh 74 add ecx,7FFFFFFFh
73 sbb eax,0 75 sbb eax,0
74 mov edx,dword ptr [esp+14h] 76 mov edx,dword ptr [esp+14h]
75 sbb edx,0 77 sbb edx,0
76 jmp localexit 78 jmp localexit
77 integer_QnaN_or_zero: 79 integer_QnaN_or_zero:
78 mov edx,dword ptr [esp+14h] 80 mov edx,dword ptr [esp+14h]
79 test edx,7FFFFFFFh 81 test edx,7FFFFFFFh
80 jne arg_is_not_integer_QnaN 82 jne arg_is_not_integer_QnaN
81 fstp dword ptr [esp+18h] 83 fstp dword ptr [esp+18h]
82 fstp dword ptr [esp+18h] 84 fstp dword ptr [esp+18h]
83 localexit: 85 localexit:
84 leave 86 leave
85 ret 87 ret
86 } 88 }
87 } 89 /* *INDENT-ON* */
88 void __declspec(naked) _ftol2_sse() 90 }
89 { 91
90 _ftol(); 92 void
93 __declspec(naked)
94 _ftol2_sse()
95 {
96 _ftol();
91 } 97 }
92 98
93 /* 64-bit math operators for 32-bit systems */ 99 /* 64-bit math operators for 32-bit systems */
94 void __declspec(naked) _allmul() 100 void
95 { 101 __declspec(naked)
96 __asm { 102 _allmul()
97 push ebp 103 {
98 mov ebp,esp 104 /* *INDENT-OFF* */
99 push edi 105 __asm {
100 push esi 106 push ebp
101 push ebx 107 mov ebp,esp
102 sub esp,0Ch 108 push edi
103 mov eax,dword ptr [ebp+10h] 109 push esi
104 mov edi,dword ptr [ebp+8] 110 push ebx
105 mov ebx,eax 111 sub esp,0Ch
106 mov esi,eax 112 mov eax,dword ptr [ebp+10h]
107 sar esi,1Fh 113 mov edi,dword ptr [ebp+8]
108 mov eax,dword ptr [ebp+8] 114 mov ebx,eax
109 mul ebx 115 mov esi,eax
110 imul edi,esi 116 sar esi,1Fh
111 mov ecx,edx 117 mov eax,dword ptr [ebp+8]
112 mov dword ptr [ebp-18h],eax 118 mul ebx
113 mov edx,dword ptr [ebp+0Ch] 119 imul edi,esi
114 add ecx,edi 120 mov ecx,edx
115 imul ebx,edx 121 mov dword ptr [ebp-18h],eax
116 mov eax,dword ptr [ebp-18h] 122 mov edx,dword ptr [ebp+0Ch]
117 lea ebx,[ebx+ecx] 123 add ecx,edi
118 mov dword ptr [ebp-14h],ebx 124 imul ebx,edx
119 mov edx,dword ptr [ebp-14h] 125 mov eax,dword ptr [ebp-18h]
120 add esp,0Ch 126 lea ebx,[ebx+ecx]
121 pop ebx 127 mov dword ptr [ebp-14h],ebx
122 pop esi 128 mov edx,dword ptr [ebp-14h]
123 pop edi 129 add esp,0Ch
124 pop ebp 130 pop ebx
125 ret 131 pop esi
126 } 132 pop edi
127 } 133 pop ebp
128 void __declspec(naked) _alldiv() 134 ret
129 { 135 }
130 __asm { 136 /* *INDENT-ON* */
131 push edi 137 }
132 push esi 138 void
133 push ebx 139 __declspec(naked)
134 xor edi,edi 140 _alldiv()
135 mov eax,dword ptr [esp+14h] 141 {
136 or eax,eax 142 /* *INDENT-OFF* */
137 jge L1 143 __asm {
138 inc edi 144 push edi
139 mov edx,dword ptr [esp+10h] 145 push esi
140 neg eax 146 push ebx
141 neg edx 147 xor edi,edi
142 sbb eax,0 148 mov eax,dword ptr [esp+14h]
143 mov dword ptr [esp+14h],eax 149 or eax,eax
144 mov dword ptr [esp+10h],edx 150 jge L1
151 inc edi
152 mov edx,dword ptr [esp+10h]
153 neg eax
154 neg edx
155 sbb eax,0
156 mov dword ptr [esp+14h],eax
157 mov dword ptr [esp+10h],edx
145 L1: 158 L1:
146 mov eax,dword ptr [esp+1Ch] 159 mov eax,dword ptr [esp+1Ch]
147 or eax,eax 160 or eax,eax
148 jge L2 161 jge L2
149 inc edi 162 inc edi
150 mov edx,dword ptr [esp+18h] 163 mov edx,dword ptr [esp+18h]
151 neg eax 164 neg eax
152 neg edx 165 neg edx
153 sbb eax,0 166 sbb eax,0
154 mov dword ptr [esp+1Ch],eax 167 mov dword ptr [esp+1Ch],eax
155 mov dword ptr [esp+18h],edx 168 mov dword ptr [esp+18h],edx
156 L2: 169 L2:
157 or eax,eax 170 or eax,eax
158 jne L3 171 jne L3
159 mov ecx,dword ptr [esp+18h] 172 mov ecx,dword ptr [esp+18h]
160 mov eax,dword ptr [esp+14h] 173 mov eax,dword ptr [esp+14h]
161 xor edx,edx 174 xor edx,edx
162 div ecx 175 div ecx
163 mov ebx,eax 176 mov ebx,eax
164 mov eax,dword ptr [esp+10h] 177 mov eax,dword ptr [esp+10h]
165 div ecx 178 div ecx
166 mov edx,ebx 179 mov edx,ebx
167 jmp L4 180 jmp L4
168 L3: 181 L3:
169 mov ebx,eax 182 mov ebx,eax
170 mov ecx,dword ptr [esp+18h] 183 mov ecx,dword ptr [esp+18h]
171 mov edx,dword ptr [esp+14h] 184 mov edx,dword ptr [esp+14h]
172 mov eax,dword ptr [esp+10h] 185 mov eax,dword ptr [esp+10h]
173 L5: 186 L5:
174 shr ebx,1 187 shr ebx,1
175 rcr ecx,1 188 rcr ecx,1
176 shr edx,1 189 shr edx,1
177 rcr eax,1 190 rcr eax,1
178 or ebx,ebx 191 or ebx,ebx
179 jne L5 192 jne L5
180 div ecx 193 div ecx
181 mov esi,eax 194 mov esi,eax
182 mul dword ptr [esp+1Ch] 195 mul dword ptr [esp+1Ch]
183 mov ecx,eax 196 mov ecx,eax
184 mov eax,dword ptr [esp+18h] 197 mov eax,dword ptr [esp+18h]
185 mul esi 198 mul esi
186 add edx,ecx 199 add edx,ecx
187 jb L6 200 jb L6
188 cmp edx,dword ptr [esp+14h] 201 cmp edx,dword ptr [esp+14h]
189 ja L6 202 ja L6
190 jb L7 203 jb L7
191 cmp eax,dword ptr [esp+10h] 204 cmp eax,dword ptr [esp+10h]
192 jbe L7 205 jbe L7
193 L6: 206 L6:
194 dec esi 207 dec esi
195 L7: 208 L7:
196 xor edx,edx 209 xor edx,edx
197 mov eax,esi 210 mov eax,esi
198 L4: 211 L4:
199 dec edi 212 dec edi
200 jne L8 213 jne L8
201 neg edx 214 neg edx
202 neg eax 215 neg eax
203 sbb edx,0 216 sbb edx,0
204 L8: 217 L8:
205 pop ebx 218 pop ebx
206 pop esi 219 pop esi
207 pop edi 220 pop edi
208 ret 10h 221 ret 10h
209 } 222 }
210 } 223 /* *INDENT-ON* */
211 void __declspec(naked) _aulldiv() 224 }
212 { 225 void
213 __asm { 226 __declspec(naked)
214 push ebx 227 _aulldiv()
215 push esi 228 {
216 mov eax,dword ptr [esp+18h] 229 /* *INDENT-OFF* */
217 or eax,eax 230 __asm {
218 jne L1 231 push ebx
219 mov ecx,dword ptr [esp+14h] 232 push esi
220 mov eax,dword ptr [esp+10h] 233 mov eax,dword ptr [esp+18h]
221 xor edx,edx 234 or eax,eax
222 div ecx 235 jne L1
223 mov ebx,eax 236 mov ecx,dword ptr [esp+14h]
224 mov eax,dword ptr [esp+0Ch] 237 mov eax,dword ptr [esp+10h]
225 div ecx 238 xor edx,edx
226 mov edx,ebx 239 div ecx
227 jmp L2 240 mov ebx,eax
241 mov eax,dword ptr [esp+0Ch]
242 div ecx
243 mov edx,ebx
244 jmp L2
228 L1: 245 L1:
229 mov ecx,eax 246 mov ecx,eax
230 mov ebx,dword ptr [esp+14h] 247 mov ebx,dword ptr [esp+14h]
231 mov edx,dword ptr [esp+10h] 248 mov edx,dword ptr [esp+10h]
232 mov eax,dword ptr [esp+0Ch] 249 mov eax,dword ptr [esp+0Ch]
233 L3: 250 L3:
234 shr ecx,1 251 shr ecx,1
235 rcr ebx,1 252 rcr ebx,1
236 shr edx,1 253 shr edx,1
237 rcr eax,1 254 rcr eax,1
238 or ecx,ecx 255 or ecx,ecx
239 jne L3 256 jne L3
240 div ebx 257 div ebx
241 mov esi,eax 258 mov esi,eax
242 mul dword ptr [esp+18h] 259 mul dword ptr [esp+18h]
243 mov ecx,eax 260 mov ecx,eax
244 mov eax,dword ptr [esp+14h] 261 mov eax,dword ptr [esp+14h]
245 mul esi 262 mul esi
246 add edx,ecx 263 add edx,ecx
247 jb L4 264 jb L4
248 cmp edx,dword ptr [esp+10h] 265 cmp edx,dword ptr [esp+10h]
249 ja L4 266 ja L4
250 jb L5 267 jb L5
251 cmp eax,dword ptr [esp+0Ch] 268 cmp eax,dword ptr [esp+0Ch]
252 jbe L5 269 jbe L5
253 L4: 270 L4:
254 dec esi 271 dec esi
255 L5: 272 L5:
256 xor edx,edx 273 xor edx,edx
257 mov eax,esi 274 mov eax,esi
258 L2: 275 L2:
259 pop esi 276 pop esi
260 pop ebx 277 pop ebx
261 ret 10h 278 ret 10h
262 } 279 }
263 } 280 /* *INDENT-ON* */
264 void __declspec(naked) _allrem() 281 }
265 { 282 void
266 __asm { 283 __declspec(naked)
267 push ebx 284 _allrem()
268 push edi 285 {
269 xor edi,edi 286 /* *INDENT-OFF* */
270 mov eax,dword ptr [esp+10h] 287 __asm {
271 or eax,eax 288 push ebx
272 jge L1 289 push edi
273 inc edi 290 xor edi,edi
274 mov edx,dword ptr [esp+0Ch] 291 mov eax,dword ptr [esp+10h]
275 neg eax 292 or eax,eax
276 neg edx 293 jge L1
277 sbb eax,0 294 inc edi
278 mov dword ptr [esp+10h],eax 295 mov edx,dword ptr [esp+0Ch]
279 mov dword ptr [esp+0Ch],edx 296 neg eax
297 neg edx
298 sbb eax,0
299 mov dword ptr [esp+10h],eax
300 mov dword ptr [esp+0Ch],edx
280 L1: 301 L1:
281 mov eax,dword ptr [esp+18h] 302 mov eax,dword ptr [esp+18h]
282 or eax,eax 303 or eax,eax
283 jge L2 304 jge L2
284 mov edx,dword ptr [esp+14h] 305 mov edx,dword ptr [esp+14h]
285 neg eax 306 neg eax
286 neg edx 307 neg edx
287 sbb eax,0 308 sbb eax,0
288 mov dword ptr [esp+18h],eax 309 mov dword ptr [esp+18h],eax
289 mov dword ptr [esp+14h],edx 310 mov dword ptr [esp+14h],edx
290 L2: 311 L2:
291 or eax,eax 312 or eax,eax
292 jne L3 313 jne L3
293 mov ecx,dword ptr [esp+14h] 314 mov ecx,dword ptr [esp+14h]
294 mov eax,dword ptr [esp+10h] 315 mov eax,dword ptr [esp+10h]
295 xor edx,edx 316 xor edx,edx
296 div ecx 317 div ecx
297 mov eax,dword ptr [esp+0Ch] 318 mov eax,dword ptr [esp+0Ch]
298 div ecx 319 div ecx
299 mov eax,edx 320 mov eax,edx
300 xor edx,edx 321 xor edx,edx
301 dec edi 322 dec edi
302 jns L4 323 jns L4
303 jmp L8 324 jmp L8
304 L3: 325 L3:
305 mov ebx,eax 326 mov ebx,eax
306 mov ecx,dword ptr [esp+14h] 327 mov ecx,dword ptr [esp+14h]
307 mov edx,dword ptr [esp+10h] 328 mov edx,dword ptr [esp+10h]
308 mov eax,dword ptr [esp+0Ch] 329 mov eax,dword ptr [esp+0Ch]
309 L5: 330 L5:
310 shr ebx,1 331 shr ebx,1
311 rcr ecx,1 332 rcr ecx,1
312 shr edx,1 333 shr edx,1
313 rcr eax,1 334 rcr eax,1
314 or ebx,ebx 335 or ebx,ebx
315 jne L5 336 jne L5
316 div ecx 337 div ecx
317 mov ecx,eax 338 mov ecx,eax
318 mul dword ptr [esp+18h] 339 mul dword ptr [esp+18h]
319 xchg eax,ecx 340 xchg eax,ecx
320 mul dword ptr [esp+14h] 341 mul dword ptr [esp+14h]
321 add edx,ecx 342 add edx,ecx
322 jb L6 343 jb L6
323 cmp edx,dword ptr [esp+10h] 344 cmp edx,dword ptr [esp+10h]
324 ja L6 345 ja L6
325 jb L7 346 jb L7
326 cmp eax,dword ptr [esp+0Ch] 347 cmp eax,dword ptr [esp+0Ch]
327 jbe L7 348 jbe L7
328 L6: 349 L6:
329 sub eax,dword ptr [esp+14h] 350 sub eax,dword ptr [esp+14h]
330 sbb edx,dword ptr [esp+18h] 351 sbb edx,dword ptr [esp+18h]
331 L7: 352 L7:
332 sub eax,dword ptr [esp+0Ch] 353 sub eax,dword ptr [esp+0Ch]
333 sbb edx,dword ptr [esp+10h] 354 sbb edx,dword ptr [esp+10h]
334 dec edi 355 dec edi
335 jns L8 356 jns L8
336 L4: 357 L4:
337 neg edx 358 neg edx
338 neg eax 359 neg eax
339 sbb edx,0 360 sbb edx,0
340 L8: 361 L8:
341 pop edi 362 pop edi
342 pop ebx 363 pop ebx
343 ret 10h 364 ret 10h
344 } 365 }
345 } 366 /* *INDENT-ON* */
346 void __declspec(naked) _aullrem() 367 }
347 { 368 void
348 __asm { 369 __declspec(naked)
349 push ebx 370 _aullrem()
350 mov eax,dword ptr [esp+14h] 371 {
351 or eax,eax 372 /* *INDENT-OFF* */
352 jne L1 373 __asm {
353 mov ecx,dword ptr [esp+10h] 374 push ebx
354 mov eax,dword ptr [esp+0Ch] 375 mov eax,dword ptr [esp+14h]
355 xor edx,edx 376 or eax,eax
356 div ecx 377 jne L1
357 mov eax,dword ptr [esp+8] 378 mov ecx,dword ptr [esp+10h]
358 div ecx 379 mov eax,dword ptr [esp+0Ch]
359 mov eax,edx 380 xor edx,edx
360 xor edx,edx 381 div ecx
361 jmp L2 382 mov eax,dword ptr [esp+8]
383 div ecx
384 mov eax,edx
385 xor edx,edx
386 jmp L2
362 L1: 387 L1:
363 mov ecx,eax 388 mov ecx,eax
364 mov ebx,dword ptr [esp+10h] 389 mov ebx,dword ptr [esp+10h]
365 mov edx,dword ptr [esp+0Ch] 390 mov edx,dword ptr [esp+0Ch]
366 mov eax,dword ptr [esp+8] 391 mov eax,dword ptr [esp+8]
367 L3: 392 L3:
368 shr ecx,1 393 shr ecx,1
369 rcr ebx,1 394 rcr ebx,1
370 shr edx,1 395 shr edx,1
371 rcr eax,1 396 rcr eax,1
372 or ecx,ecx 397 or ecx,ecx
373 jne L3 398 jne L3
374 div ebx 399 div ebx
375 mov ecx,eax 400 mov ecx,eax
376 mul dword ptr [esp+14h] 401 mul dword ptr [esp+14h]
377 xchg eax,ecx 402 xchg eax,ecx
378 mul dword ptr [esp+10h] 403 mul dword ptr [esp+10h]
379 add edx,ecx 404 add edx,ecx
380 jb L4 405 jb L4
381 cmp edx,dword ptr [esp+0Ch] 406 cmp edx,dword ptr [esp+0Ch]
382 ja L4 407 ja L4
383 jb L5 408 jb L5
384 cmp eax,dword ptr [esp+8] 409 cmp eax,dword ptr [esp+8]
385 jbe L5 410 jbe L5
386 L4: 411 L4:
387 sub eax,dword ptr [esp+10h] 412 sub eax,dword ptr [esp+10h]
388 sbb edx,dword ptr [esp+14h] 413 sbb edx,dword ptr [esp+14h]
389 L5: 414 L5:
390 sub eax,dword ptr [esp+8] 415 sub eax,dword ptr [esp+8]
391 sbb edx,dword ptr [esp+0Ch] 416 sbb edx,dword ptr [esp+0Ch]
392 neg edx 417 neg edx
393 neg eax 418 neg eax
394 sbb edx,0 419 sbb edx,0
395 L2: 420 L2:
396 pop ebx 421 pop ebx
397 ret 10h 422 ret 10h
398 } 423 }
399 } 424 /* *INDENT-ON* */
400 void __declspec(naked) _alldvrm() 425 }
401 { 426 void
402 __asm { 427 __declspec(naked)
403 push edi 428 _alldvrm()
404 push esi 429 {
405 push ebp 430 /* *INDENT-OFF* */
406 xor edi,edi 431 __asm {
407 xor ebp,ebp 432 push edi
408 mov eax,dword ptr [esp+14h] 433 push esi
409 or eax,eax 434 push ebp
410 jge L1 435 xor edi,edi
411 inc edi 436 xor ebp,ebp
412 inc ebp 437 mov eax,dword ptr [esp+14h]
413 mov edx,dword ptr [esp+10h] 438 or eax,eax
414 neg eax 439 jge L1
415 neg edx 440 inc edi
416 sbb eax,0 441 inc ebp
417 mov dword ptr [esp+14h],eax 442 mov edx,dword ptr [esp+10h]
418 mov dword ptr [esp+10h],edx 443 neg eax
444 neg edx
445 sbb eax,0
446 mov dword ptr [esp+14h],eax
447 mov dword ptr [esp+10h],edx
419 L1: 448 L1:
420 mov eax,dword ptr [esp+1Ch] 449 mov eax,dword ptr [esp+1Ch]
421 or eax,eax 450 or eax,eax
422 jge L2 451 jge L2
423 inc edi 452 inc edi
424 mov edx,dword ptr [esp+18h] 453 mov edx,dword ptr [esp+18h]
425 neg eax 454 neg eax
426 neg edx 455 neg edx
427 sbb eax,0 456 sbb eax,0
428 mov dword ptr [esp+1Ch],eax 457 mov dword ptr [esp+1Ch],eax
429 mov dword ptr [esp+18h],edx 458 mov dword ptr [esp+18h],edx
430 L2: 459 L2:
431 or eax,eax 460 or eax,eax
432 jne L3 461 jne L3
433 mov ecx,dword ptr [esp+18h] 462 mov ecx,dword ptr [esp+18h]
434 mov eax,dword ptr [esp+14h] 463 mov eax,dword ptr [esp+14h]
435 xor edx,edx 464 xor edx,edx
436 div ecx 465 div ecx
437 mov ebx,eax 466 mov ebx,eax
438 mov eax,dword ptr [esp+10h] 467 mov eax,dword ptr [esp+10h]
439 div ecx 468 div ecx
440 mov esi,eax 469 mov esi,eax
441 mov eax,ebx 470 mov eax,ebx
442 mul dword ptr [esp+18h] 471 mul dword ptr [esp+18h]
443 mov ecx,eax 472 mov ecx,eax
444 mov eax,esi 473 mov eax,esi
445 mul dword ptr [esp+18h] 474 mul dword ptr [esp+18h]
446 add edx,ecx 475 add edx,ecx
447 jmp L4 476 jmp L4
448 L3: 477 L3:
449 mov ebx,eax 478 mov ebx,eax
450 mov ecx,dword ptr [esp+18h] 479 mov ecx,dword ptr [esp+18h]
451 mov edx,dword ptr [esp+14h] 480 mov edx,dword ptr [esp+14h]
452 mov eax,dword ptr [esp+10h] 481 mov eax,dword ptr [esp+10h]
453 L5: 482 L5:
454 shr ebx,1 483 shr ebx,1
455 rcr ecx,1 484 rcr ecx,1
456 shr edx,1 485 shr edx,1
457 rcr eax,1 486 rcr eax,1
458 or ebx,ebx 487 or ebx,ebx
459 jne L5 488 jne L5
460 div ecx 489 div ecx
461 mov esi,eax 490 mov esi,eax
462 mul dword ptr [esp+1Ch] 491 mul dword ptr [esp+1Ch]
463 mov ecx,eax 492 mov ecx,eax
464 mov eax,dword ptr [esp+18h] 493 mov eax,dword ptr [esp+18h]
465 mul esi 494 mul esi
466 add edx,ecx 495 add edx,ecx
467 jb L6 496 jb L6
468 cmp edx,dword ptr [esp+14h] 497 cmp edx,dword ptr [esp+14h]
469 ja L6 498 ja L6
470 jb L7 499 jb L7
471 cmp eax,dword ptr [esp+10h] 500 cmp eax,dword ptr [esp+10h]
472 jbe L7 501 jbe L7
473 L6: 502 L6:
474 dec esi 503 dec esi
475 sub eax,dword ptr [esp+18h] 504 sub eax,dword ptr [esp+18h]
476 sbb edx,dword ptr [esp+1Ch] 505 sbb edx,dword ptr [esp+1Ch]
477 L7: 506 L7:
478 xor ebx,ebx 507 xor ebx,ebx
479 L4: 508 L4:
480 sub eax,dword ptr [esp+10h] 509 sub eax,dword ptr [esp+10h]
481 sbb edx,dword ptr [esp+14h] 510 sbb edx,dword ptr [esp+14h]
482 dec ebp 511 dec ebp
483 jns L9 512 jns L9
484 neg edx 513 neg edx
485 neg eax 514 neg eax
486 sbb edx,0 515 sbb edx,0
487 L9: 516 L9:
488 mov ecx,edx 517 mov ecx,edx
489 mov edx,ebx 518 mov edx,ebx
490 mov ebx,ecx 519 mov ebx,ecx
491 mov ecx,eax 520 mov ecx,eax
492 mov eax,esi 521 mov eax,esi
493 dec edi 522 dec edi
494 jne L8 523 jne L8
495 neg edx 524 neg edx
496 neg eax 525 neg eax
497 sbb edx,0 526 sbb edx,0
498 L8: 527 L8:
499 pop ebp 528 pop ebp
500 pop esi 529 pop esi
501 pop edi 530 pop edi
502 ret 10h 531 ret 10h
503 } 532 }
504 } 533 /* *INDENT-ON* */
505 void __declspec(naked) _aulldvrm() 534 }
506 { 535 void
507 __asm { 536 __declspec(naked)
508 push esi 537 _aulldvrm()
509 mov eax,dword ptr [esp+14h] 538 {
510 or eax,eax 539 /* *INDENT-OFF* */
511 jne L1 540 __asm {
512 mov ecx,dword ptr [esp+10h] 541 push esi
513 mov eax,dword ptr [esp+0Ch] 542 mov eax,dword ptr [esp+14h]
514 xor edx,edx 543 or eax,eax
515 div ecx 544 jne L1
516 mov ebx,eax 545 mov ecx,dword ptr [esp+10h]
517 mov eax,dword ptr [esp+8] 546 mov eax,dword ptr [esp+0Ch]
518 div ecx 547 xor edx,edx
519 mov esi,eax 548 div ecx
520 mov eax,ebx 549 mov ebx,eax
521 mul dword ptr [esp+10h] 550 mov eax,dword ptr [esp+8]
522 mov ecx,eax 551 div ecx
523 mov eax,esi 552 mov esi,eax
524 mul dword ptr [esp+10h] 553 mov eax,ebx
525 add edx,ecx 554 mul dword ptr [esp+10h]
526 jmp L2 555 mov ecx,eax
556 mov eax,esi
557 mul dword ptr [esp+10h]
558 add edx,ecx
559 jmp L2
527 L1: 560 L1:
528 mov ecx,eax 561 mov ecx,eax
529 mov ebx,dword ptr [esp+10h] 562 mov ebx,dword ptr [esp+10h]
530 mov edx,dword ptr [esp+0Ch] 563 mov edx,dword ptr [esp+0Ch]
531 mov eax,dword ptr [esp+8] 564 mov eax,dword ptr [esp+8]
532 L3: 565 L3:
533 shr ecx,1 566 shr ecx,1
534 rcr ebx,1 567 rcr ebx,1
535 shr edx,1 568 shr edx,1
536 rcr eax,1 569 rcr eax,1
537 or ecx,ecx 570 or ecx,ecx
538 jne L3 571 jne L3
539 div ebx 572 div ebx
540 mov esi,eax 573 mov esi,eax
541 mul dword ptr [esp+14h] 574 mul dword ptr [esp+14h]
542 mov ecx,eax 575 mov ecx,eax
543 mov eax,dword ptr [esp+10h] 576 mov eax,dword ptr [esp+10h]
544 mul esi 577 mul esi
545 add edx,ecx 578 add edx,ecx
546 jb L4 579 jb L4
547 cmp edx,dword ptr [esp+0Ch] 580 cmp edx,dword ptr [esp+0Ch]
548 ja L4 581 ja L4
549 jb L5 582 jb L5
550 cmp eax,dword ptr [esp+8] 583 cmp eax,dword ptr [esp+8]
551 jbe L5 584 jbe L5
552 L4: 585 L4:
553 dec esi 586 dec esi
554 sub eax,dword ptr [esp+10h] 587 sub eax,dword ptr [esp+10h]
555 sbb edx,dword ptr [esp+14h] 588 sbb edx,dword ptr [esp+14h]
556 L5: 589 L5:
557 xor ebx,ebx 590 xor ebx,ebx
558 L2: 591 L2:
559 sub eax,dword ptr [esp+8] 592 sub eax,dword ptr [esp+8]
560 sbb edx,dword ptr [esp+0Ch] 593 sbb edx,dword ptr [esp+0Ch]
561 neg edx 594 neg edx
562 neg eax 595 neg eax
563 sbb edx,0 596 sbb edx,0
564 mov ecx,edx 597 mov ecx,edx
565 mov edx,ebx 598 mov edx,ebx
566 mov ebx,ecx 599 mov ebx,ecx
567 mov ecx,eax 600 mov ecx,eax
568 mov eax,esi 601 mov eax,esi
569 pop esi 602 pop esi
570 ret 10h 603 ret 10h
571 } 604 }
572 } 605 /* *INDENT-ON* */
573 void __declspec(naked) _allshl() 606 }
574 { 607 void
575 __asm { 608 __declspec(naked)
576 cmp cl,40h 609 _allshl()
577 jae RETZERO 610 {
578 cmp cl,20h 611 /* *INDENT-OFF* */
579 jae MORE32 612 __asm {
580 shld edx,eax,cl 613 cmp cl,40h
581 shl eax,cl 614 jae RETZERO
582 ret 615 cmp cl,20h
616 jae MORE32
617 shld edx,eax,cl
618 shl eax,cl
619 ret
583 MORE32: 620 MORE32:
584 mov edx,eax 621 mov edx,eax
585 xor eax,eax 622 xor eax,eax
586 and cl,1Fh 623 and cl,1Fh
587 shl edx,cl 624 shl edx,cl
588 ret 625 ret
589 RETZERO: 626 RETZERO:
590 xor eax,eax 627 xor eax,eax
591 xor edx,edx 628 xor edx,edx
592 ret 629 ret
593 } 630 }
594 } 631 /* *INDENT-ON* */
595 void __declspec(naked) _aullshr() 632 }
596 { 633 void
597 __asm { 634 __declspec(naked)
598 cmp cl,40h 635 _aullshr()
599 jae RETZERO 636 {
600 cmp cl,20h 637 /* *INDENT-OFF* */
601 jae MORE32 638 __asm {
602 shrd eax,edx,cl 639 cmp cl,40h
603 shr edx,cl 640 jae RETZERO
604 ret 641 cmp cl,20h
642 jae MORE32
643 shrd eax,edx,cl
644 shr edx,cl
645 ret
605 MORE32: 646 MORE32:
606 mov eax,edx 647 mov eax,edx
607 xor edx,edx 648 xor edx,edx
608 and cl,1Fh 649 and cl,1Fh
609 shr eax,cl 650 shr eax,cl
610 ret 651 ret
611 RETZERO: 652 RETZERO:
612 xor eax,eax 653 xor eax,eax
613 xor edx,edx 654 xor edx,edx
614 ret 655 ret
615 } 656 }
657 /* *INDENT-ON* */
616 } 658 }
617 659
618 #endif /* MSC_VER */ 660 #endif /* MSC_VER */
619 661
620 #endif /* !HAVE_LIBC */ 662 #endif /* !HAVE_LIBC */
663
664 /* vi: set ts=4 sw=4 expandtab: */