NetBSD/lib/libc/arch/ns32k/gen/flt_rounds.c

32 lines
597 B
C
Raw Normal View History

/* $NetBSD: flt_rounds.c,v 1.4 1997/10/27 05:28:46 phil Exp $ */
1995-04-29 01:57:00 +04:00
/*
* Written by J.T. Conklin, Apr 28, 1995
* Public domain.
*/
1997-07-13 22:45:15 +04:00
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.4 1997/10/27 05:28:46 phil Exp $");
#endif /* LIBC_SCCS and not lint */
#include <machine/cpufunc.h>
1995-04-29 01:57:00 +04:00
static const int map[] = {
1, /* round to nearest */
0, /* round to zero */
2, /* round to positive infinity */
3 /* round to negative infinity */
};
int __flt_rounds __P((void));
1995-04-29 01:57:00 +04:00
int
__flt_rounds(void)
1995-04-29 01:57:00 +04:00
{
int x;
sfsr(x);
1995-04-29 01:57:00 +04:00
return map[(x >> 7) & 0x03];
}