summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/fetestexcept.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/fetestexcept.c')
-rw-r--r--winsup/mingw/mingwex/fetestexcept.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/fetestexcept.c b/winsup/mingw/mingwex/fetestexcept.c
new file mode 100644
index 000000000..6934ed925
--- /dev/null
+++ b/winsup/mingw/mingwex/fetestexcept.c
@@ -0,0 +1,15 @@
+#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;
+}