Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/feclearexcept.c')
-rw-r--r--winsup/mingw/mingwex/feclearexcept.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/feclearexcept.c b/winsup/mingw/mingwex/feclearexcept.c
new file mode 100644
index 000000000..e6017fc9d
--- /dev/null
+++ b/winsup/mingw/mingwex/feclearexcept.c
@@ -0,0 +1,14 @@
+#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;
+}