xref: /netbsd-src/lib/libc/arch/sparc/gen/flt_rounds.c (revision a0c1305064c6fa996613d6b155ca66a675978be1)
1 /*
2  * Written by J.T. Conklin, Apr 10, 1995
3  * Public domain.
4  */
5 
6 static const int map[] = {
7 	1,	/* round to nearest */
8 	0,	/* round to zero */
9 	3,	/* round to negative infinity */
10 	2	/* round to positive infinity */
11 };
12 
13 int
14 __flt_rounds()
15 {
16 	int x;
17 
18 	__asm__("st %%fsr,%0" : "=m" (*&x));
19 	return map[(x >> 30) & 0x03];
20 }
21