freebsd-dev/lib/libc/amd64/gen/flt_rounds.c
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00

25 lines
452 B
C

/*
* Written by J.T. Conklin, Apr 10, 1995
* Public domain.
*/
#include <sys/cdefs.h>
#include <float.h>
static const int map[] = {
1, /* round to nearest */
3, /* round to zero */
2, /* round to negative infinity */
0 /* round to positive infinity */
};
int
__flt_rounds(void)
{
int x;
/* Assume that the x87 and the SSE unit agree on the rounding mode. */
__asm("fnstcw %0" : "=m" (x));
return (map[(x >> 10) & 0x03]);
}