xref: /openbsd/lib/libc/arch/m88k/gen/flt_rounds.c (revision d89ec533)
1 /*	$OpenBSD: flt_rounds.c,v 1.6 2015/10/27 05:54:49 guenther Exp $	*/
2 
3 /*
4  * Written by J.T. Conklin, Apr 10, 1995
5  * Public domain.
6  */
7 
8 #include <sys/types.h>
9 #include <float.h>
10 
11 /*
12  * Ported to 88k (Nivas Madhur)
13  */
14 
15 static const int map[] = {
16 	1,	/* round to nearest */
17 	0,	/* round to zero */
18 	3,	/* round to negative infinity */
19 	2	/* round to positive infinity */
20 };
21 
22 int
23 __flt_rounds()
24 {
25 	int x;
26 
27 	__asm__("fldcr %0, %%fcr63" : "=r" (x));
28 	return map[(x >> 14) & 0x03];
29 }
30 DEF_STRONG(__flt_rounds);
31