xref: /netbsd-src/lib/libc/arch/mips/gen/flt_rounds.c (revision 76dfffe33547c37f8bdd446e3e4ab0f3c16cea4b)
1 /*	$NetBSD: flt_rounds.c,v 1.2 1996/09/16 18:10:42 jonathan Exp $	*/
2 
3 /*
4  * Written by J.T. Conklin, Apr 11, 1995
5  * Public domain.
6  */
7 
8 static const int map[] = {
9 	1,	/* round to nearest */
10 	0,	/* round to zero */
11 	2,	/* round to positive infinity */
12 	3	/* round to negative infinity */
13 };
14 
15 int
16 __flt_rounds()
17 {
18 	int x;
19 
20 	__asm__("cfc1 %0,$31" : "=r" (x));
21 	return map[x & 0x03];
22 }
23