kernel: scheduling fix for ARM
[minix.git] / lib / libc / arch / sparc / gen / flt_rounds.c
blobc64b1ff8627234c58b63f427a744b100fd138ac1
1 /* $NetBSD: flt_rounds.c,v 1.7 2012/03/21 00:38:34 christos Exp $ */
3 /*
4 * Written by J.T. Conklin, Apr 10, 1995
5 * Public domain.
6 */
8 #include <sys/cdefs.h>
9 #if defined(LIBC_SCCS) && !defined(lint)
10 __RCSID("$NetBSD: flt_rounds.c,v 1.7 2012/03/21 00:38:34 christos Exp $");
11 #endif /* LIBC_SCCS and not lint */
13 #include <sys/types.h>
14 #include <machine/float.h>
16 static const int map[] = {
17 1, /* round to nearest */
18 0, /* round to zero */
19 2, /* round to positive infinity */
20 3 /* round to negative infinity */
23 int
24 __flt_rounds(void)
26 unsigned int x;
28 __asm("st %%fsr,%0" : "=m" (*&x));
29 return map[(x >> 30) & 0x03];