flt_rounds.c revision 259065
1/* 2 * Written by J.T. Conklin, Apr 10, 1995 3 * Public domain. 4 */ 5 6#include <sys/cdefs.h> 7__FBSDID("$FreeBSD: releng/10.0/lib/libc/ia64/gen/flt_rounds.c 132383 2004-07-19 08:17:25Z das $"); 8 9#include <float.h> 10 11static const int map[] = { 12 1, /* round to nearest */ 13 3, /* round to zero */ 14 2, /* round to negative infinity */ 15 0 /* round to positive infinity */ 16}; 17 18int 19__flt_rounds(void) 20{ 21 int x; 22 23 __asm("mov %0=ar.fpsr" : "=r" (x)); 24 return (map[(x >> 10) & 0x03]); 25} 26