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