msvcrt: Use fpclass constants from public header.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-12-01 13:51:59 +01:00 committed by Alexandre Julliard
parent 09d018c73d
commit 480e25a5f6
2 changed files with 17 additions and 29 deletions

View File

@ -218,13 +218,13 @@ int CDECL MSVCRT__fpclassf( float num )
switch (e) switch (e)
{ {
case 0: case 0:
if (u.i << 1) return s ? MSVCRT__FPCLASS_ND : MSVCRT__FPCLASS_PD; if (u.i << 1) return s ? _FPCLASS_ND : _FPCLASS_PD;
return s ? MSVCRT__FPCLASS_NZ : MSVCRT__FPCLASS_PZ; return s ? _FPCLASS_NZ : _FPCLASS_PZ;
case 0xff: case 0xff:
if (u.i << 9) return ((u.i >> 22) & 1) ? MSVCRT__FPCLASS_QNAN : MSVCRT__FPCLASS_SNAN; if (u.i << 9) return ((u.i >> 22) & 1) ? _FPCLASS_QNAN : _FPCLASS_SNAN;
return s ? MSVCRT__FPCLASS_NINF : MSVCRT__FPCLASS_PINF; return s ? _FPCLASS_NINF : _FPCLASS_PINF;
default: default:
return s ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN; return s ? _FPCLASS_NN : _FPCLASS_PN;
} }
} }
@ -1419,13 +1419,13 @@ int CDECL MSVCRT__fpclass(double num)
switch (e) switch (e)
{ {
case 0: case 0:
if (u.i << 1) return s ? MSVCRT__FPCLASS_ND : MSVCRT__FPCLASS_PD; if (u.i << 1) return s ? _FPCLASS_ND : _FPCLASS_PD;
return s ? MSVCRT__FPCLASS_NZ : MSVCRT__FPCLASS_PZ; return s ? _FPCLASS_NZ : _FPCLASS_PZ;
case 0x7ff: case 0x7ff:
if (u.i << 12) return ((u.i >> 51) & 1) ? MSVCRT__FPCLASS_QNAN : MSVCRT__FPCLASS_SNAN; if (u.i << 12) return ((u.i >> 51) & 1) ? _FPCLASS_QNAN : _FPCLASS_SNAN;
return s ? MSVCRT__FPCLASS_NINF : MSVCRT__FPCLASS_PINF; return s ? _FPCLASS_NINF : _FPCLASS_PINF;
default: default:
return s ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN; return s ? _FPCLASS_NN : _FPCLASS_PN;
} }
} }
@ -2285,7 +2285,7 @@ double CDECL MSVCRT__y0(double num)
if (!isfinite(num)) *_errno() = EDOM; if (!isfinite(num)) *_errno() = EDOM;
retval = unix_funcs->y0( num ); retval = unix_funcs->y0( num );
if (MSVCRT__fpclass(retval) == MSVCRT__FPCLASS_NINF) if (MSVCRT__fpclass(retval) == _FPCLASS_NINF)
{ {
*_errno() = EDOM; *_errno() = EDOM;
retval = NAN; retval = NAN;
@ -2302,7 +2302,7 @@ double CDECL MSVCRT__y1(double num)
if (!isfinite(num)) *_errno() = EDOM; if (!isfinite(num)) *_errno() = EDOM;
retval = unix_funcs->y1( num ); retval = unix_funcs->y1( num );
if (MSVCRT__fpclass(retval) == MSVCRT__FPCLASS_NINF) if (MSVCRT__fpclass(retval) == _FPCLASS_NINF)
{ {
*_errno() = EDOM; *_errno() = EDOM;
retval = NAN; retval = NAN;
@ -2319,7 +2319,7 @@ double CDECL MSVCRT__yn(int order, double num)
if (!isfinite(num)) *_errno() = EDOM; if (!isfinite(num)) *_errno() = EDOM;
retval = unix_funcs->yn( order, num ); retval = unix_funcs->yn( order, num );
if (MSVCRT__fpclass(retval) == MSVCRT__FPCLASS_NINF) if (MSVCRT__fpclass(retval) == _FPCLASS_NINF)
{ {
*_errno() = EDOM; *_errno() = EDOM;
retval = NAN; retval = NAN;
@ -2351,8 +2351,8 @@ float CDECL MSVCRT_nearbyintf(float num)
double CDECL MSVCRT_nexttoward(double num, double next) double CDECL MSVCRT_nexttoward(double num, double next)
{ {
double ret = unix_funcs->nexttoward(num, next); double ret = unix_funcs->nexttoward(num, next);
if (!(MSVCRT__fpclass(ret) & (MSVCRT__FPCLASS_PN | MSVCRT__FPCLASS_NN if (!(MSVCRT__fpclass(ret) & (_FPCLASS_PN | _FPCLASS_NN
| MSVCRT__FPCLASS_SNAN | MSVCRT__FPCLASS_QNAN)) && !isinf(num)) | _FPCLASS_SNAN | _FPCLASS_QNAN)) && !isinf(num))
{ {
*_errno() = ERANGE; *_errno() = ERANGE;
} }
@ -2365,8 +2365,8 @@ double CDECL MSVCRT_nexttoward(double num, double next)
float CDECL MSVCRT_nexttowardf(float num, double next) float CDECL MSVCRT_nexttowardf(float num, double next)
{ {
float ret = unix_funcs->nexttowardf( num, next ); float ret = unix_funcs->nexttowardf( num, next );
if (!(MSVCRT__fpclass(ret) & (MSVCRT__FPCLASS_PN | MSVCRT__FPCLASS_NN if (!(MSVCRT__fpclass(ret) & (_FPCLASS_PN | _FPCLASS_NN
| MSVCRT__FPCLASS_SNAN | MSVCRT__FPCLASS_QNAN)) && !isinf(num)) | _FPCLASS_SNAN | _FPCLASS_QNAN)) && !isinf(num))
{ {
*_errno() = ERANGE; *_errno() = ERANGE;
} }

View File

@ -626,18 +626,6 @@ struct MSVCRT__stat64 {
#define MSVCRT__O_U16TEXT 0x20000 #define MSVCRT__O_U16TEXT 0x20000
#define MSVCRT__O_U8TEXT 0x40000 #define MSVCRT__O_U8TEXT 0x40000
/* fpclass constants */
#define MSVCRT__FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
#define MSVCRT__FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
#define MSVCRT__FPCLASS_NINF 0x0004 /* Negative Infinity */
#define MSVCRT__FPCLASS_NN 0x0008 /* Negative Normal */
#define MSVCRT__FPCLASS_ND 0x0010 /* Negative Denormal */
#define MSVCRT__FPCLASS_NZ 0x0020 /* Negative Zero */
#define MSVCRT__FPCLASS_PZ 0x0040 /* Positive Zero */
#define MSVCRT__FPCLASS_PD 0x0080 /* Positive Denormal */
#define MSVCRT__FPCLASS_PN 0x0100 /* Positive Normal */
#define MSVCRT__FPCLASS_PINF 0x0200 /* Positive Infinity */
/* fpclassify constants */ /* fpclassify constants */
#define MSVCRT_FP_INFINITE 1 #define MSVCRT_FP_INFINITE 1
#define MSVCRT_FP_NAN 2 #define MSVCRT_FP_NAN 2