mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
8579151e4b
fpsetround(), fpsetsticky(), obtained from NetBSD and tweaked a little to use definitions from machine/fsr.h instead of magic numbers.
31 lines
512 B
C
31 lines
512 B
C
/* $NetBSD: fpsetsticky.c,v 1.2 2002/01/13 21:45:51 thorpej Exp $ */
|
|
|
|
/*
|
|
* Written by J.T. Conklin, Apr 10, 1995
|
|
* Public domain.
|
|
*/
|
|
|
|
#include <sys/cdefs.h>
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
#include <machine/fsr.h>
|
|
#include <ieeefp.h>
|
|
|
|
fp_except_t
|
|
fpsetsticky(sticky)
|
|
fp_except_t sticky;
|
|
{
|
|
unsigned int old;
|
|
unsigned int new;
|
|
|
|
__asm__("st %%fsr,%0" : "=m" (old));
|
|
|
|
new = old;
|
|
new &= ~FSR_AEXC_MASK;
|
|
new |= FSR_AEXC(sticky & FSR_EXC_MASK);
|
|
|
|
__asm__("ld %0,%%fsr" : : "m" (new));
|
|
|
|
return (FSR_GET_AEXC(old));
|
|
}
|