Remove some unnecessary inclusions of <sys/cdefs.h> across the tree.
[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
05ecdcef
SS
6#include <float.h>
7
8static const int map[] = {
9 1, /* round to nearest */
10 3, /* round to zero */
11 2, /* round to negative infinity */
12 0 /* round to positive infinity */
13};
14
15int
16__flt_rounds(void)
17{
18 int x;
19
20 /* Assume that the x87 and the SSE unit agree on the rounding mode. */
21 __asm("fnstcw %0" : "=m" (x));
22 return (map[(x >> 10) & 0x03]);
23}