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