|
|
1.1 root 1: //////////
2: / libc/crt/i386/idcvt.s
3: / i386 C runtime library.
4: / IEEE software floating point support.
5: //////////
6:
7: //////////
8: / int _idcvt()
9: /
10: / Convert double in %edx:%eax to int, return in %eax.
11: //////////
12:
13: MAXINT .equ 0x7FFFFFFF
14: SGNMASK .equ 0x80000000
15:
16: .globl _idcvt
17: .globl _udcvt
18:
19: _idcvt:
20: orl %edx, %edx / check arg sign
21: pushfl / and save
22: jns ?posarg
23: xorl %edx, $SGNMASK / force arg positive
24: ?posarg:
25: call _udcvt / convert to unsigned
26: orl %eax, %eax / check high result bit
27: js ?overflow / too big to represent as int
28: popfl / restore arg sign
29: jns ?done
30: negl %eax / negative arg, complement result
31: ?done:
32: ret
33:
34: ?overflow:
35: movl %eax, $MAXINT
36: popfl / restore arg sign
37: jns ?done
38: incl %eax / MAXINT+1 is MININT
39: ret
40:
41: / end of libc/crt/i386/idcvt.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.