msvcp: Add _Dtest implementation.

oldstable
Piotr Caban 2015-09-12 16:13:25 +02:00 committed by Alexandre Julliard
parent 874c3f96f7
commit 1e9402124d
12 changed files with 112 additions and 27 deletions

View File

@ -2892,14 +2892,14 @@
@ extern _Denorm
@ stub _Dnorm
@ stub _Dscale
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ extern _Eps
@ stub _Exp
@ stub _FCosh
@ extern _FDenorm
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ extern _FEps
@ stub _FExp
@ extern _FInf
@ -2920,7 +2920,7 @@
@ stub _LCosh
@ extern _LDenorm
@ stub _LDscale
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ extern _LEps
@ stub _LExp
@ extern _LInf

View File

@ -3745,7 +3745,7 @@
@ cdecl _Do_call(ptr)
@ stub _Dscale
@ stub _Dtento
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ stub _Dunscale
@ extern _Eps
@ stub _Exp
@ -3755,7 +3755,7 @@
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtento
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ stub _FDunscale
@ extern _FEps
@ stub _FExp
@ -3791,7 +3791,7 @@
@ stub _LDint
@ stub _LDscale
@ stub _LDtento
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ stub _LDunscale
@ extern _LEps
@ stub _LExp

View File

@ -3686,7 +3686,7 @@
@ cdecl _Do_call(ptr)
@ stub _Dscale
@ stub _Dtento
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ stub _Dunscale
@ extern _Eps
@ stub _Exp
@ -3696,7 +3696,7 @@
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtento
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ stub _FDunscale
@ extern _FEps
@ stub _FExp
@ -3734,7 +3734,7 @@
@ stub _LDint
@ stub _LDscale
@ stub _LDtento
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ stub _LDunscale
@ extern _LEps
@ stub _LExp

View File

@ -18,10 +18,25 @@
#include <locale.h>
#include <stdio.h>
#include <math.h>
#include "wine/test.h"
#include "winbase.h"
static inline float __port_infinity(void)
{
static const unsigned __inf_bytes = 0x7f800000;
return *(const float *)&__inf_bytes;
}
#define INFINITY __port_infinity()
static inline float __port_nan(void)
{
static const unsigned __nan_bytes = 0x7fc00000;
return *(const float *)&__nan_bytes;
}
#define NAN __port_nan()
typedef int MSVCRT_long;
typedef unsigned char MSVCP_bool;
@ -70,6 +85,7 @@ static _Cvtvec* (__cdecl *p__Getcvt)(_Cvtvec*);
static void (CDECL *p__Call_once)(int *once, void (CDECL *func)(void));
static void (CDECL *p__Call_onceEx)(int *once, void (CDECL *func)(void*), void *argv);
static void (CDECL *p__Do_call)(void *this);
static short (__cdecl *p__Dtest)(double *d);
/* filesystem */
static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*);
@ -119,6 +135,8 @@ static BOOL init(void)
"_Call_onceEx");
SET(p__Do_call,
"_Do_call");
SET(p__Dtest,
"_Dtest");
if(sizeof(void*) == 8) { /* 64-bit initialization */
SET(p_tr2_sys__File_size,
"?_File_size@sys@tr2@std@@YA_KPEBD@Z");
@ -407,6 +425,32 @@ static void test__Do_call(void)
ok(cnt == 1, "func was not called\n");
}
static void test__Dtest(void)
{
double d;
short ret;
d = 0;
ret = p__Dtest(&d);
ok(ret == FP_ZERO, "_Dtest(0) returned %x\n", ret);
d = 1;
ret = p__Dtest(&d);
ok(ret == FP_NORMAL, "_Dtest(1) returned %x\n", ret);
d = -1;
ret = p__Dtest(&d);
ok(ret == FP_NORMAL, "_Dtest(-1) returned %x\n", ret);
d = INFINITY;
ret = p__Dtest(&d);
ok(ret == FP_INFINITE, "_Dtest(INF) returned %x\n", ret);
d = NAN;
ret = p__Dtest(&d);
ok(ret == FP_NAN, "_Dtest(NAN) returned %x\n", ret);
}
static void test_tr2_sys__File_size(void)
{
ULONGLONG val;
@ -910,6 +954,7 @@ START_TEST(msvcp120)
test__Getcvt();
test__Call_once();
test__Do_call();
test__Dtest();
test_tr2_sys__File_size();
test_tr2_sys__Equivalent();

View File

@ -3686,7 +3686,7 @@
@ cdecl _Do_call(ptr) msvcp120._Do_call
@ stub _Dscale
@ stub _Dtento
@ stub _Dtest
@ cdecl _Dtest(ptr) msvcp120._Dtest
@ stub _Dunscale
@ extern _Eps msvcp120._Eps
@ stub _Exp
@ -3696,7 +3696,7 @@
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtento
@ stub _FDtest
@ cdecl _FDtest(ptr) msvcp120._FDtest
@ stub _FDunscale
@ extern _FEps msvcp120._FEps
@ stub _FExp
@ -3734,7 +3734,7 @@
@ stub _LDint
@ stub _LDscale
@ stub _LDtento
@ stub _LDtest
@ cdecl _LDtest(ptr) msvcp120._LDtest
@ stub _LDunscale
@ extern _LEps msvcp120._LEps
@ stub _LExp

View File

@ -4258,14 +4258,14 @@
@ extern _Denorm _Denorm
@ stub _Dnorm
@ stub _Dscale
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ extern _Eps _Eps
@ stub _Exp
@ stub _FCosh
@ extern _FDenorm _FDenorm
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ extern _FEps _FEps
@ stub _FExp
@ extern _FInf _FInf
@ -4282,7 +4282,7 @@
@ stub _LCosh
@ extern _LDenorm _LDenorm
@ stub _LDscale
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ extern _LEps _LEps
@ stub _LExp
@ extern _LInf _LInf

View File

@ -5044,14 +5044,14 @@
@ extern _Denorm
@ stub _Dnorm
@ stub _Dscale
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ extern _Eps
@ stub _Exp
@ stub _FCosh
@ extern _FDenorm
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ extern _FEps
@ stub _FExp
@ extern _FInf
@ -5069,7 +5069,7 @@
@ stub _LCosh
@ extern _LDenorm
@ stub _LDscale
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ extern _LEps
@ stub _LExp
@ extern _LInf

View File

@ -5098,14 +5098,14 @@
@ extern _Denorm
@ stub _Dnorm
@ stub _Dscale
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ extern _Eps
@ stub _Exp
@ stub _FCosh
@ extern _FDenorm
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ extern _FEps
@ stub _FExp
@ extern _FInf
@ -5125,7 +5125,7 @@
@ stub _LCosh
@ extern _LDenorm
@ stub _LDscale
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ extern _LEps
@ stub _LExp
@ extern _LInf

View File

@ -5705,7 +5705,7 @@
@ stub _Dnorm
@ stub _Dscale
@ stub _Dtentox
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ stub _Dunscale
@ extern _Eps
@ stub _Exp
@ -5714,7 +5714,7 @@
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtentox
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ stub _FDunscale
@ extern _FEps
@ stub _FExp
@ -5736,7 +5736,7 @@
@ extern _LDenorm
@ stub _LDscale
@ stub _LDtentox
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ stub _LDunscale
@ extern _LEps
@ stub _LExp

View File

@ -2226,3 +2226,37 @@ complex_double* __cdecl complex_double_sqrt(complex_double *ret, const complex_d
complex_double c = { 0.5, 0 };
return complex_double_pow(ret, l, &c);
}
static short dclass(double x)
{
switch(_fpclass(x)) {
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
return FP_NAN;
case _FPCLASS_NINF:
case _FPCLASS_PINF:
return FP_INFINITE;
case _FPCLASS_ND:
case _FPCLASS_PD:
return FP_SUBNORMAL;
case _FPCLASS_NN:
case _FPCLASS_PN:
default:
return FP_NORMAL;
case _FPCLASS_NZ:
case _FPCLASS_PZ:
return FP_ZERO;
}
}
/* _Dtest */
short __cdecl _Dtest(double *x)
{
return dclass(*x);
}
/* _FDtest */
short __cdecl _FDtest(float *x)
{
return dclass(*x);
}

View File

@ -6480,14 +6480,14 @@
@ extern _Denorm
@ stub _Dnorm
@ stub _Dscale
@ stub _Dtest
@ cdecl _Dtest(ptr)
@ extern _Eps
@ stub _Exp
@ stub _FCosh
@ extern _FDenorm
@ stub _FDnorm
@ stub _FDscale
@ stub _FDtest
@ cdecl _FDtest(ptr)
@ extern _FEps
@ stub _FExp
@ extern _FInf
@ -6507,7 +6507,7 @@
@ stub _LCosh
@ extern _LDenorm
@ stub _LDscale
@ stub _LDtest
@ cdecl _LDtest(ptr) _Dtest
@ extern _LEps
@ stub _LExp
@ extern _LInf

View File

@ -146,6 +146,12 @@ static const union {
# endif
#endif
#define FP_INFINITE 1
#define FP_NAN 2
#define FP_NORMAL -1
#define FP_SUBNORMAL -2
#define FP_ZERO 0
#ifdef __cplusplus
}
#endif