msvcr120: Add fegetexceptflag.

Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2021-03-11 23:12:10 -08:00 committed by Alexandre Julliard
parent fd0c03c644
commit 9fa81aab5f
7 changed files with 27 additions and 4 deletions

View File

@ -89,7 +89,7 @@
@ cdecl exit(long) ucrtbase.exit
@ cdecl feclearexcept(long) ucrtbase.feclearexcept
@ cdecl fegetenv(ptr) ucrtbase.fegetenv
@ stub fegetexceptflag
@ cdecl fegetexceptflag(ptr long) ucrtbase.fegetexceptflag
@ cdecl fegetround() ucrtbase.fegetround
@ stub feholdexcept
@ cdecl fesetenv(ptr) ucrtbase.fesetenv

View File

@ -2145,7 +2145,7 @@
@ cdecl fdiml(double double) fdim
@ cdecl feclearexcept(long)
@ cdecl fegetenv(ptr)
@ stub fegetexceptflag
@ cdecl fegetexceptflag(ptr long)
@ cdecl fegetround()
@ stub feholdexcept
@ cdecl feof(ptr)

View File

@ -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_fegetexceptflag)(fexcept_t*,int);
static int (CDECL *p_fesetexceptflag)(const fexcept_t*,int);
static int (CDECL *p_fetestexcept)(int);
static int (CDECL *p_feclearexcept)(int);
@ -260,6 +261,7 @@ static BOOL init(void)
SET(p_fesetenv, "fesetenv");
SET(p_fegetround, "fegetround");
SET(p_fesetround, "fesetround");
SET(p_fegetexceptflag, "fegetexceptflag");
SET(p_fesetexceptflag, "fesetexceptflag");
SET(p_fetestexcept, "fetestexcept");
SET(p_feclearexcept, "feclearexcept");
@ -849,6 +851,7 @@ static void test_feenv(void)
if(0) { /* crash on windows */
p_fesetexceptflag(NULL, FE_ALL_EXCEPT);
p_fegetexceptflag(NULL, 0);
}
except = FE_ALL_EXCEPT;
ret = p_fesetexceptflag(&except, FE_INEXACT|FE_UNDERFLOW);
@ -890,6 +893,16 @@ static void test_feenv(void)
flags |= tests[i];
ret = p_fetestexcept(FE_ALL_EXCEPT);
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++) {

View File

@ -1811,7 +1811,7 @@
@ cdecl fdiml(double double) msvcr120.fdiml
@ cdecl feclearexcept(long) msvcr120.feclearexcept
@ cdecl fegetenv(ptr) msvcr120.fegetenv
@ stub fegetexceptflag
@ cdecl fegetexceptflag(ptr long) msvcr120.fegetexceptflag
@ cdecl fegetround() msvcr120.fegetround
@ stub feholdexcept
@ cdecl feof(ptr) msvcr120.feof

View File

@ -2251,6 +2251,15 @@ int CDECL feclearexcept(int flags)
env._Fe_stat &= ~(flags & FE_ALL_EXCEPT);
return fesetenv(&env);
}
/*********************************************************************
* fegetexceptflag (MSVCR120.@)
*/
int CDECL fegetexceptflag(fexcept_t *status, int excepts)
{
*status = _statusfp() & excepts;
return 0;
}
#endif
#if _MSVCR_VER>=140

View File

@ -2288,7 +2288,7 @@
@ cdecl fdiml(double double) fdim
@ cdecl feclearexcept(long)
@ cdecl fegetenv(ptr)
@ stub fegetexceptflag
@ cdecl fegetexceptflag(ptr long)
@ cdecl fegetround()
@ stub feholdexcept
@ cdecl feof(ptr)

View File

@ -34,6 +34,7 @@ typedef __msvcrt_ulong fexcept_t;
_ACRTIMP int __cdecl fegetenv(fenv_t*);
_ACRTIMP int __cdecl fesetenv(const fenv_t*);
_ACRTIMP int __cdecl fegetexceptflag(fexcept_t*, int);
_ACRTIMP int __cdecl fegetround(void);
_ACRTIMP int __cdecl fesetround(int);
_ACRTIMP int __cdecl fesetexceptflag(const fexcept_t*, int);