Commit 7981ab4f authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcr120: Add fetestexcept.

parent 272d35af
......@@ -95,7 +95,7 @@
@ cdecl fesetenv(ptr) ucrtbase.fesetenv
@ stub fesetexceptflag
@ cdecl fesetround(long) ucrtbase.fesetround
@ stub fetestexcept
@ cdecl fetestexcept(long) ucrtbase.fetestexcept
@ cdecl perror(str) ucrtbase.perror
@ cdecl quick_exit(long) ucrtbase.quick_exit
@ cdecl raise(long) ucrtbase.raise
......
......@@ -2154,7 +2154,7 @@
@ cdecl fesetenv(ptr)
@ stub fesetexceptflag
@ cdecl fesetround(long)
@ stub fetestexcept
@ cdecl fetestexcept(long)
@ stub feupdateenv
@ cdecl fflush(ptr)
@ cdecl fgetc(ptr)
......
......@@ -182,6 +182,7 @@ static int (CDECL *p_fegetenv)(fenv_t*);
static int (CDECL *p_fesetenv)(const fenv_t*);
static int (CDECL *p_fegetround)(void);
static int (CDECL *p_fesetround)(int);
static int (CDECL *p_fetestexcept)(int);
static int (CDECL *p__clearfp)(void);
static _locale_t (__cdecl *p_wcreate_locale)(int, const wchar_t *);
static void (__cdecl *p_free_locale)(_locale_t);
......@@ -257,6 +258,7 @@ static BOOL init(void)
SET(p_fesetenv, "fesetenv");
SET(p_fegetround, "fegetround");
SET(p_fesetround, "fesetround");
SET(p_fetestexcept, "fetestexcept");
SET(p__clearfp, "_clearfp");
SET(p_vsscanf, "vsscanf");
......@@ -788,8 +790,17 @@ static void test_critical_section(void)
static void test_feenv(void)
{
static const int tests[] = {
0,
FE_INEXACT,
FE_UNDERFLOW,
FE_OVERFLOW,
FE_DIVBYZERO,
FE_INVALID,
FE_ALL_EXCEPT,
};
fenv_t env, env2;
int ret;
int i, ret, flags;
p__clearfp();
......@@ -807,6 +818,26 @@ static void test_feenv(void)
ok(!ret, "fesetenv returned %x\n", ret);
ret = p_fegetround();
ok(ret == FE_TONEAREST, "Got unexpected round mode %#x.\n", ret);
ret = p_fetestexcept(FE_ALL_EXCEPT);
ok(!ret, "fetestexcept returned %x\n", ret);
flags = 0;
for(i=0; i<ARRAY_SIZE(tests); i++) {
ret = p_fegetenv(&env);
ok(!ret, "Test %d: fegetenv returned %x\n", i, ret);
env._Fe_stat |= tests[i];
ret = p_fesetenv(&env);
ok(!ret, "Test %d: fesetenv returned %x\n", i, ret);
ret = p_fetestexcept(tests[i]);
ok(ret == tests[i], "Test %d: expected %x, got %x\n", i, tests[i], ret);
flags |= tests[i];
ret = p_fetestexcept(FE_ALL_EXCEPT);
ok(ret == flags, "Test %d: expected %x, got %x\n", i, flags, ret);
}
p__clearfp();
}
static void test__wcreate_locale(void)
......
......@@ -1820,7 +1820,7 @@
@ cdecl fesetenv(ptr) msvcr120.fesetenv
@ stub fesetexceptflag
@ cdecl fesetround(long) msvcr120.fesetround
@ stub fetestexcept
@ cdecl fetestexcept(long) msvcr120.fetestexcept
@ stub feupdateenv
@ cdecl fflush(ptr) msvcr120.fflush
@ cdecl fgetc(ptr) msvcr120.fgetc
......
......@@ -2214,6 +2214,14 @@ int CDECL fegetenv(fenv_t *env)
env->_Fe_stat = _statusfp();
return 0;
}
/*********************************************************************
* fetestexcept (MSVCR120.@)
*/
int CDECL fetestexcept(int flags)
{
return _statusfp() & flags;
}
#endif
#if _MSVCR_VER>=140
......
......@@ -2296,7 +2296,7 @@
@ cdecl fesetenv(ptr)
@ stub fesetexceptflag
@ cdecl fesetround(long)
@ stub fetestexcept
@ cdecl fetestexcept(long)
@ cdecl fflush(ptr)
@ cdecl fgetc(ptr)
@ cdecl fgetpos(ptr ptr)
......
......@@ -34,6 +34,7 @@ _ACRTIMP int __cdecl fegetenv(fenv_t*);
_ACRTIMP int __cdecl fesetenv(const fenv_t*);
_ACRTIMP int __cdecl fegetround(void);
_ACRTIMP int __cdecl fesetround(int);
_ACRTIMP int __cdecl fetestexcept(int);
#ifdef __cplusplus
}
......
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