<iso646.h>: Avoid conflicts w/ C++ keywords.
[dragonfly.git] / lib / libc / i386 / gen / fpsetround.S
1 /*
2  * Written by Charles M. Hannum, Apr 9, 1995
3  * Public domain.
4  *
5  * $NetBSD: fpsetround.S,v 1.3 2002/01/13 21:45:43 thorpej Exp $
6  * $DragonFly: src/lib/libc/i386/gen/fpsetround.S,v 1.1 2005/07/26 21:15:19 joerg Exp $
7  */
8
9 #include <machine/asm.h>
10
11 #ifdef WEAK_ALIAS
12 WEAK_ALIAS(fpsetround, _fpsetround)
13 ENTRY(_fpsetround)
14 #else
15 ENTRY(fpsetround)
16 #endif
17         subl $4,%esp
18
19         fnstcw (%esp)
20         movl (%esp),%eax
21
22         rorl $10,%eax
23         movl %eax,%edx
24         andl $3,%eax
25
26         subl %eax,%edx
27         movl 8(%esp),%ecx
28         andl $3,%ecx
29         orl %ecx,%edx
30         roll $10,%edx
31         movl %edx,(%esp)
32         fldcw (%esp)
33
34         addl $4,%esp
35         ret