1 /* 2 * Written by J.T. Conklin, Apr 11, 1995 3 * Public domain. 4 */ 5 6 static const int map[] = { 7 1, /* round to nearest */ 8 0, /* round to zero */ 9 2, /* round to positive infinity */ 10 3 /* round to negative infinity */ 11 }; 12 13 int 14 __flt_rounds() 15 { 16 int x; 17 18 __asm__("cfc1 %0,$31" : "=r" (x)); 19 return map[x & 0x03]; 20 } 21