1 /* $NetBSD: flt_rounds.c,v 1.1 1997/03/29 20:55:55 thorpej Exp $ */ 2 3 static const int map[] = { 4 1, /* round to nearest */ 5 0, /* round to zero */ 6 2, /* round to positive infinity */ 7 3 /* round to negative infinity */ 8 }; 9 10 int 11 __flt_rounds() 12 { 13 double tmp; 14 int x; 15 16 asm("mffs %0; stfiwx %0,0,%1" : "=f"(tmp): "b"(&x)); 17 return map[x & 0x03]; 18 } 19