Revert "rename amd64 architecture to x86_64"
[dragonfly.git] / lib / libc / amd64 / gen / flt_rounds.c
1 /*
2  * Written by J.T. Conklin, Apr 10, 1995
3  * Public domain.
4  *
5  * $DragonFly: src/lib/libc/amd64/gen/flt_rounds.c,v 1.1 2006/07/27 00:46:57 corecode Exp $
6  */
7
8 #include <sys/cdefs.h>
9
10 #include <float.h>
11
12 static const int map[] = {
13         1,      /* round to nearest */
14         3,      /* round to zero */
15         2,      /* round to negative infinity */
16         0       /* round to positive infinity */
17 };
18
19 int
20 __flt_rounds(void)
21 {
22         int x;
23
24         /* Assume that the x87 and the SSE unit agree on the rounding mode. */
25         __asm("fnstcw %0" : "=m" (x));
26         return (map[(x >> 10) & 0x03]);
27 }