/contrib/sdk/sources/newlib/libc/math/feclearexcept.c |
---|
0,0 → 1,15 |
#include <fenv.h> |
/* 7.6.2.1 |
The feclearexcept function clears the supported exceptions |
represented by its argument. |
*/ |
int feclearexcept (int excepts) |
{ |
fenv_t _env; |
__asm__ volatile ("fnstenv %0;" : "=m" (_env)); /* get the env */ |
_env.__status_word &= ~(excepts & FE_ALL_EXCEPT); /* clear the except */ |
__asm__ volatile ("fldenv %0;" :: "m" (_env)); /*set the env */ |
return 0; |
} |
/contrib/sdk/sources/newlib/libc/math/fetestexcept.c |
---|
0,0 → 1,17 |
#include <fenv.h> |
/* 7.6.2.5 |
The fetestexcept function determines which of a specified subset of |
the exception flags are currently set. The excepts argument |
specifies the exception flags to be queried. |
The fetestexcept function returns the value of the bitwise OR of the |
exception macros corresponding to the currently set exceptions |
included in excepts. |
*/ |
int fetestexcept (int excepts) |
{ |
unsigned short _sw; |
__asm__ ("fnstsw %%ax" : "=a" (_sw)); |
return _sw & excepts & FE_ALL_EXCEPT; |
} |