Commit 9fa81aab authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcr120: Add fegetexceptflag.

parent fd0c03c6
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
@ cdecl exit(long) ucrtbase.exit @ cdecl exit(long) ucrtbase.exit
@ cdecl feclearexcept(long) ucrtbase.feclearexcept @ cdecl feclearexcept(long) ucrtbase.feclearexcept
@ cdecl fegetenv(ptr) ucrtbase.fegetenv @ cdecl fegetenv(ptr) ucrtbase.fegetenv
@ stub fegetexceptflag @ cdecl fegetexceptflag(ptr long) ucrtbase.fegetexceptflag
@ cdecl fegetround() ucrtbase.fegetround @ cdecl fegetround() ucrtbase.fegetround
@ stub feholdexcept @ stub feholdexcept
@ cdecl fesetenv(ptr) ucrtbase.fesetenv @ cdecl fesetenv(ptr) ucrtbase.fesetenv
......
...@@ -2145,7 +2145,7 @@ ...@@ -2145,7 +2145,7 @@
@ cdecl fdiml(double double) fdim @ cdecl fdiml(double double) fdim
@ cdecl feclearexcept(long) @ cdecl feclearexcept(long)
@ cdecl fegetenv(ptr) @ cdecl fegetenv(ptr)
@ stub fegetexceptflag @ cdecl fegetexceptflag(ptr long)
@ cdecl fegetround() @ cdecl fegetround()
@ stub feholdexcept @ stub feholdexcept
@ cdecl feof(ptr) @ cdecl feof(ptr)
......
...@@ -182,6 +182,7 @@ static int (CDECL *p_fegetenv)(fenv_t*); ...@@ -182,6 +182,7 @@ static int (CDECL *p_fegetenv)(fenv_t*);
static int (CDECL *p_fesetenv)(const fenv_t*); static int (CDECL *p_fesetenv)(const fenv_t*);
static int (CDECL *p_fegetround)(void); static int (CDECL *p_fegetround)(void);
static int (CDECL *p_fesetround)(int); static int (CDECL *p_fesetround)(int);
static int (CDECL *p_fegetexceptflag)(fexcept_t*,int);
static int (CDECL *p_fesetexceptflag)(const fexcept_t*,int); static int (CDECL *p_fesetexceptflag)(const fexcept_t*,int);
static int (CDECL *p_fetestexcept)(int); static int (CDECL *p_fetestexcept)(int);
static int (CDECL *p_feclearexcept)(int); static int (CDECL *p_feclearexcept)(int);
...@@ -260,6 +261,7 @@ static BOOL init(void) ...@@ -260,6 +261,7 @@ static BOOL init(void)
SET(p_fesetenv, "fesetenv"); SET(p_fesetenv, "fesetenv");
SET(p_fegetround, "fegetround"); SET(p_fegetround, "fegetround");
SET(p_fesetround, "fesetround"); SET(p_fesetround, "fesetround");
SET(p_fegetexceptflag, "fegetexceptflag");
SET(p_fesetexceptflag, "fesetexceptflag"); SET(p_fesetexceptflag, "fesetexceptflag");
SET(p_fetestexcept, "fetestexcept"); SET(p_fetestexcept, "fetestexcept");
SET(p_feclearexcept, "feclearexcept"); SET(p_feclearexcept, "feclearexcept");
...@@ -849,6 +851,7 @@ static void test_feenv(void) ...@@ -849,6 +851,7 @@ static void test_feenv(void)
if(0) { /* crash on windows */ if(0) { /* crash on windows */
p_fesetexceptflag(NULL, FE_ALL_EXCEPT); p_fesetexceptflag(NULL, FE_ALL_EXCEPT);
p_fegetexceptflag(NULL, 0);
} }
except = FE_ALL_EXCEPT; except = FE_ALL_EXCEPT;
ret = p_fesetexceptflag(&except, FE_INEXACT|FE_UNDERFLOW); ret = p_fesetexceptflag(&except, FE_INEXACT|FE_UNDERFLOW);
...@@ -890,6 +893,16 @@ static void test_feenv(void) ...@@ -890,6 +893,16 @@ static void test_feenv(void)
flags |= tests[i]; flags |= tests[i];
ret = p_fetestexcept(FE_ALL_EXCEPT); ret = p_fetestexcept(FE_ALL_EXCEPT);
ok(ret == flags, "Test %d: expected %x, got %x\n", i, flags, ret); ok(ret == flags, "Test %d: expected %x, got %x\n", i, flags, ret);
except = ~0;
ret = p_fegetexceptflag(&except, ~0);
ok(!ret, "Test %d: fegetexceptflag returned %x.\n", i, ret);
ok(except == flags, "Test %d: expected %x, got %lx\n", i, flags, except);
except = ~0;
ret = p_fegetexceptflag(&except, tests[i]);
ok(!ret, "Test %d: fegetexceptflag returned %x.\n", i, ret);
ok(except == tests[i], "Test %d: expected %x, got %lx\n", i, tests[i], except);
} }
for(i=0; i<ARRAY_SIZE(tests); i++) { for(i=0; i<ARRAY_SIZE(tests); i++) {
......
...@@ -1811,7 +1811,7 @@ ...@@ -1811,7 +1811,7 @@
@ cdecl fdiml(double double) msvcr120.fdiml @ cdecl fdiml(double double) msvcr120.fdiml
@ cdecl feclearexcept(long) msvcr120.feclearexcept @ cdecl feclearexcept(long) msvcr120.feclearexcept
@ cdecl fegetenv(ptr) msvcr120.fegetenv @ cdecl fegetenv(ptr) msvcr120.fegetenv
@ stub fegetexceptflag @ cdecl fegetexceptflag(ptr long) msvcr120.fegetexceptflag
@ cdecl fegetround() msvcr120.fegetround @ cdecl fegetround() msvcr120.fegetround
@ stub feholdexcept @ stub feholdexcept
@ cdecl feof(ptr) msvcr120.feof @ cdecl feof(ptr) msvcr120.feof
......
...@@ -2251,6 +2251,15 @@ int CDECL feclearexcept(int flags) ...@@ -2251,6 +2251,15 @@ int CDECL feclearexcept(int flags)
env._Fe_stat &= ~(flags & FE_ALL_EXCEPT); env._Fe_stat &= ~(flags & FE_ALL_EXCEPT);
return fesetenv(&env); return fesetenv(&env);
} }
/*********************************************************************
* fegetexceptflag (MSVCR120.@)
*/
int CDECL fegetexceptflag(fexcept_t *status, int excepts)
{
*status = _statusfp() & excepts;
return 0;
}
#endif #endif
#if _MSVCR_VER>=140 #if _MSVCR_VER>=140
......
...@@ -2288,7 +2288,7 @@ ...@@ -2288,7 +2288,7 @@
@ cdecl fdiml(double double) fdim @ cdecl fdiml(double double) fdim
@ cdecl feclearexcept(long) @ cdecl feclearexcept(long)
@ cdecl fegetenv(ptr) @ cdecl fegetenv(ptr)
@ stub fegetexceptflag @ cdecl fegetexceptflag(ptr long)
@ cdecl fegetround() @ cdecl fegetround()
@ stub feholdexcept @ stub feholdexcept
@ cdecl feof(ptr) @ cdecl feof(ptr)
......
...@@ -34,6 +34,7 @@ typedef __msvcrt_ulong fexcept_t; ...@@ -34,6 +34,7 @@ typedef __msvcrt_ulong fexcept_t;
_ACRTIMP int __cdecl fegetenv(fenv_t*); _ACRTIMP int __cdecl fegetenv(fenv_t*);
_ACRTIMP int __cdecl fesetenv(const fenv_t*); _ACRTIMP int __cdecl fesetenv(const fenv_t*);
_ACRTIMP int __cdecl fegetexceptflag(fexcept_t*, int);
_ACRTIMP int __cdecl fegetround(void); _ACRTIMP int __cdecl fegetround(void);
_ACRTIMP int __cdecl fesetround(int); _ACRTIMP int __cdecl fesetround(int);
_ACRTIMP int __cdecl fesetexceptflag(const fexcept_t*, int); _ACRTIMP int __cdecl fesetexceptflag(const fexcept_t*, int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment