* mingwex/fegetenv.c (fegetenv): Restore exception masks.

* mingwex/feholdexcept.c (feholdexcept): Don't set exceptions
	to non-stop. Use "fnclex" to clear exception flags.
This commit is contained in:
Danny Smith 2005-10-08 02:14:45 +00:00
parent f011605a90
commit a174593722
3 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2005-10-08 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/fegetenv.c (fegetenv): Restore exception masks.
* mingwex/feholdexcept.c (feholdexcept): Don't set exceptions
to non-stop. Use "fnclex" to clear exception flags.
2005-09-24 Danny Smith <dannysmith@users.sourceforge.net>
* include/math.h (HUGE_VALF, HUGE_VALL, INFINITY, NAN)

View File

@ -7,6 +7,8 @@
int fegetenv (fenv_t * envp)
{
__asm__ ("fnstenv %0;": "=m" (*envp));
/* fnstenv sets control word to non-stop for all exceptions, so we
need to reload our env to restore the original mask. */
__asm__ ("fldenv %0" : : "m" (*envp));
return 0;
}

View File

@ -8,11 +8,9 @@
int feholdexcept (fenv_t * envp)
{
fenv_t tmp_env;
__asm__ ("fnstenv %0;" : "=m" (* envp)); /* save current into envp */
tmp_env = * envp;
tmp_env.__status_word &= ~FE_ALL_EXCEPT; /* clear exception flags */
tmp_env.__control_word |= FE_ALL_EXCEPT; /* set cw to non-stop */
__asm__ volatile ("fldenv %0;" : : "m" (tmp_env)); /* install the copy */
/* fnstenv sets control word to non-stop for all exceptions, so all we
need to do is clear the exception flags. */
__asm__ ("fnclex");
return 0;
}