]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/sparc64/gen/flt_rounds.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / sparc64 / gen / flt_rounds.c
1 /*
2  * Written by J.T. Conklin, Apr 10, 1995
3  * Public domain.
4  */
5
6 #include <sys/cdefs.h>
7 __FBSDID("$FreeBSD$");
8
9 #include <sys/types.h>
10 #include <machine/float.h>
11
12 static const int map[] = {
13         1,      /* round to nearest */
14         0,      /* round to zero */
15         2,      /* round to positive infinity */
16         3       /* round to negative infinity */
17 };
18
19 int
20 __flt_rounds()
21 {
22         int x;
23
24         __asm("st %%fsr,%0" : "=m" (*&x));
25         return map[(x >> 30) & 0x03];
26 }