flt_rounds.c revision 1.1
11.1Sjtc/*
21.1Sjtc * Written by J.T. Conklin, Apr 10, 1995
31.1Sjtc * Public domain.
41.1Sjtc */
51.1Sjtc
61.1Sjtcstatic const int map[] = {
71.1Sjtc	1,	/* round to nearest */
81.1Sjtc	0,	/* round to zero */
91.1Sjtc	3,	/* round to negative infinity */
101.1Sjtc	2	/* round to positive infinity */
111.1Sjtc};
121.1Sjtc
131.1Sjtcint
141.1Sjtc__flt_rounds()
151.1Sjtc{
161.1Sjtc	int x;
171.1Sjtc
181.1Sjtc	__asm__("st %%fsr,%0" : "=m" (*&x));
191.1Sjtc	return map[(x >> 30) & 0x03];
201.1Sjtc}
21