flt_rounds.c revision 1.1
1/*
2 * Written by J.T. Conklin, Apr 10, 1995
3 * Public domain.
4 */
5
6static 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
13int
14__flt_rounds()
15{
16	int x;
17
18	__asm__("st %%fsr,%0" : "=m" (*&x));
19	return map[(x >> 30) & 0x03];
20}
21