OSDN Git Service

More rationalization of CRT_INLINE function implementations.
[mingw/mingw-org-wsl.git] / mingwrt / mingwex / feraiseexcept.c
1 #include <fenv.h>
2
3 /* 7.6.2.3
4    The feraiseexcept function raises the supported exceptions
5    represented by its argument The order in which these exceptions
6    are raised is unspecified, except as stated in F.7.6.
7    Whether the feraiseexcept function additionally raises
8    the inexact exception whenever it raises the overflow
9    or underflow exception is implementation-defined. */
10
11 int feraiseexcept (int excepts)
12 {
13   fenv_t _env;
14   __asm__ volatile ("fnstenv %0;" : "=m" (_env));
15   _env.__status_word |= excepts & FE_ALL_EXCEPT;
16   __asm__ volatile ("fldenv %0;"
17                     "fwait;" : : "m" (_env));
18   return 0;
19 }