4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / lib / libc / i386 / gen / fixunsdfsi.s
CommitLineData
95001734 1/*-
b17c65bb
KB
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
95001734
WN
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * %sccs.include.redist.c%
9 */
10
11#if defined(LIBC_SCCS) && !defined(lint)
b17c65bb 12 .asciz "@(#)fixunsdfsi.s 8.1 %G%"
95001734
WN
13#endif /* LIBC_SCCS and not lint */
14
15 .globl ___fixunsdfsi
16___fixunsdfsi:
17 fldl 4(%esp) /* argument double to accum stack */
18 frndint /* create integer */
19 fcoml fbiggestsigned /* bigger than biggest signed? */
20 fstsw %ax
21 sahf
22 jnb 1f
23
24 fistpl 4(%esp)
25 movl 4(%esp),%eax
26 ret
27
281: fsubl fbiggestsigned /* reduce for proper conversion */
29 fistpl 4(%esp) /* convert */
30 movl 4(%esp),%eax
31 orl $0x80000000,%eax /* restore bias */
32 ret
33
34fbiggestsigned: .double 0r2147483648.0