YongHao Hu : msvcp90: Add std_Ctraits::Isnan implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 10 07:49:47 CST 2014
Module: wine
Branch: master
Commit: 6fe4d9e71ba0e9adfca240eeffea5720f03afef8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6fe4d9e71ba0e9adfca240eeffea5720f03afef8
Author: YongHao Hu <christopherwuy at gmail.com>
Date: Sat Nov 8 10:15:21 2014 +0800
msvcp90: Add std_Ctraits::Isnan implementation.
---
dlls/msvcp70/msvcp70.spec | 6 +++---
dlls/msvcp71/msvcp71.spec | 6 +++---
dlls/msvcp80/msvcp80.spec | 6 +++---
dlls/msvcp90/math.c | 9 +++++++++
dlls/msvcp90/msvcp90.spec | 6 +++---
dlls/msvcp90/tests/misc.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 69 insertions(+), 12 deletions(-)
diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec
index 749e64a..7067efa 100644
--- a/dlls/msvcp70/msvcp70.spec
+++ b/dlls/msvcp70/msvcp70.spec
@@ -2103,9 +2103,9 @@
@ stub ?_Isinf@?$_Ctraits at M@std@@SA_NM at Z
@ stub ?_Isinf@?$_Ctraits at N@std@@SA_NN at Z
@ stub ?_Isinf@?$_Ctraits at O@std@@SA_NO at Z
-@ stub ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z
-@ stub ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z
-@ stub ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z
+@ cdecl ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z(float) std_Ctraits_float__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z(double) std_Ctraits_double__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z(double) std_Ctraits_long_double__Isnan
@ stub -arch=win32 ?_Loc_atexit at std@@YA_NP6AXXZ at Z
@ stub -arch=win32 ?_Makpat@?$_Mpunct at D@std@@AAEXAAUpattern at money_base@2 at III@Z
@ stub -arch=win64 ?_Makpat@?$_Mpunct at D@std@@AEAAXAEAUpattern at money_base@2 at III@Z
diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec
index 1b56e17..0bac67c 100644
--- a/dlls/msvcp71/msvcp71.spec
+++ b/dlls/msvcp71/msvcp71.spec
@@ -2300,9 +2300,9 @@
@ stub ?_Isinf@?$_Ctraits at M@std@@SA_NM at Z
@ stub ?_Isinf@?$_Ctraits at N@std@@SA_NN at Z
@ stub ?_Isinf@?$_Ctraits at O@std@@SA_NO at Z
-@ stub ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z
-@ stub ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z
-@ stub ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z
+@ cdecl ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z(float) std_Ctraits_float__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z(double) std_Ctraits_double__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z(double) std_Ctraits_long_double__Isnan
@ thiscall -arch=win32 ?_Lock@?$basic_streambuf at DU?$char_traits at D@std@@@std@@QAEXXZ(ptr) basic_streambuf_char__Lock
@ cdecl -arch=win64 ?_Lock@?$basic_streambuf at DU?$char_traits at D@std@@@std@@QEAAXXZ(ptr) basic_streambuf_char__Lock
@ thiscall -arch=win32 ?_Lock@?$basic_streambuf at GU?$char_traits at G@std@@@std@@QAEXXZ(ptr) basic_streambuf_wchar__Lock
diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec
index 31e5e60..1165491 100644
--- a/dlls/msvcp80/msvcp80.spec
+++ b/dlls/msvcp80/msvcp80.spec
@@ -2557,9 +2557,9 @@
@ stub ?_Isinf@?$_Ctraits at M@std@@SA_NM at Z
@ stub ?_Isinf@?$_Ctraits at N@std@@SA_NN at Z
@ stub ?_Isinf@?$_Ctraits at O@std@@SA_NO at Z
-@ stub ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z
-@ stub ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z
-@ stub ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z
+@ cdecl ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z(float) std_Ctraits_float__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z(double) std_Ctraits_double__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z(double) std_Ctraits_long_double__Isnan
@ cdecl -arch=win32 ?_Locimp_Addfac at _Locimp@locale at std@@CAXPAV123 at PAVfacet@23 at I@Z(ptr ptr long) locale__Locimp__Locimp_Addfac
@ cdecl -arch=win64 ?_Locimp_Addfac at _Locimp@locale at std@@CAXPEAV123 at PEAVfacet@23 at _K@Z(ptr ptr long) locale__Locimp__Locimp_Addfac
@ cdecl -arch=win32 ?_Locimp_ctor at _Locimp@locale at std@@CAXPAV123 at ABV123@@Z(ptr ptr) locale__Locimp__Locimp_ctor
diff --git a/dlls/msvcp90/math.c b/dlls/msvcp90/math.c
index 7ea6b69..439865a 100644
--- a/dlls/msvcp90/math.c
+++ b/dlls/msvcp90/math.c
@@ -815,6 +815,15 @@ std_Ctraits * __thiscall std_Ctraits_op_assign( std_Ctraits *this, std_Ctraits *
return this;
}
+/* ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z -> public: static bool __cdecl std::_Ctraits<float>::_Isnan(float) */
+BOOLEAN __cdecl std_Ctraits_float__Isnan( float x ) { return _isnan(x); }
+
+/* ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z -> public: static bool __cdecl std::_Ctraits<double>::_Isnan(double) */
+BOOLEAN __cdecl std_Ctraits_double__Isnan( double x ) { return _isnan(x); }
+
+/* ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z -> public: static bool __cdecl std::_Ctraits<long double>::_Isnan(long double) */
+BOOLEAN __cdecl std_Ctraits_long_double__Isnan( LDOUBLE x ) { return _isnan(x); }
+
/* ?atan2@?$_Ctraits at M@std@@SAMMM at Z -> public: static float __cdecl std::_Ctraits<float>::atan2(float,float) */
float __cdecl std_Ctraits_float_atan2( float y, float x ) { return atan2f( y, x ); }
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index 5271737..edb984b 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -2878,9 +2878,9 @@
@ stub ?_Isinf@?$_Ctraits at M@std@@SA_NM at Z
@ stub ?_Isinf@?$_Ctraits at N@std@@SA_NN at Z
@ stub ?_Isinf@?$_Ctraits at O@std@@SA_NO at Z
-@ stub ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z
-@ stub ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z
-@ stub ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z
+@ cdecl ?_Isnan@?$_Ctraits at M@std@@SA_NM at Z(float) std_Ctraits_float__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at N@std@@SA_NN at Z(double) std_Ctraits_double__Isnan
+@ cdecl ?_Isnan@?$_Ctraits at O@std@@SA_NO at Z(double) std_Ctraits_long_double__Isnan
@ cdecl -arch=win32 ?_Locimp_Addfac at _Locimp@locale at std@@CAXPAV123 at PAVfacet@23 at I@Z(ptr ptr long) locale__Locimp__Locimp_Addfac
@ cdecl -arch=win64 ?_Locimp_Addfac at _Locimp@locale at std@@CAXPEAV123 at PEAVfacet@23 at _K@Z(ptr ptr long) locale__Locimp__Locimp_Addfac
@ cdecl -arch=win32 ?_Locimp_ctor at _Locimp@locale at std@@CAXPAV123 at ABV123@@Z(ptr ptr) locale__Locimp__Locimp_ctor
diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c
index 26cafc9..a4e07d7 100644
--- a/dlls/msvcp90/tests/misc.c
+++ b/dlls/msvcp90/tests/misc.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <locale.h>
#include <wctype.h>
+#include <math.h>
#include <float.h>
#include <errno.h>
@@ -26,6 +27,8 @@
#include <winbase.h>
#include "wine/test.h"
+typedef double LDOUBLE; /* long double is just a double */
+
typedef struct {
LCID handle;
unsigned page;
@@ -110,6 +113,10 @@ static void (__thiscall *p_basic_ostringstream_char_dtor)(/*basic_ostringstream_
static void (__thiscall *p_basic_ostringstream_char_vbase_dtor)(/*basic_ostringstream_char*/void*);
static void (__thiscall *p_basic_ios_char_dtor)(/*basic_ios_char*/void*);
+static BOOL (__cdecl *p_std_Ctraits_float__Isnan)(float);
+static BOOL (__cdecl *p_std_Ctraits_double__Isnan)(double);
+static BOOL (__cdecl *p_std_Ctraits_long_double__Isnan)(LDOUBLE);
+
static complex_float* (__thiscall *p_complex_float_ctor)(complex_float*, const float*, const float*);
static complex_float* (__cdecl *p_complex_float_add)(complex_float*, const complex_float*, const complex_float*);
static complex_float* (__cdecl *p_complex_float_div)(complex_float*, const complex_float*, const complex_float*);
@@ -216,6 +223,11 @@ static BOOL init(void)
SET(p_wctrans, "wctrans");
SET(p_towctrans, "towctrans");
SET(basic_ostringstream_char_vbtable, "??_8?$basic_ostringstream at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@7B@");
+
+ SET(p_std_Ctraits_float__Isnan, "?_Isnan@?$_Ctraits at M@std@@SA_NM at Z");
+ SET(p_std_Ctraits_double__Isnan, "?_Isnan@?$_Ctraits at N@std@@SA_NN at Z");
+ SET(p_std_Ctraits_long_double__Isnan, "?_Isnan@?$_Ctraits at O@std@@SA_NO at Z");
+
if(sizeof(void*) == 8) { /* 64-bit initialization */
SET(p_char_assign, "?assign@?$char_traits at D@std@@SAXAEADAEBD at Z");
SET(p_wchar_assign, "?assign@?$char_traits at _W@std@@SAXAEA_WAEB_W at Z");
@@ -688,6 +700,41 @@ static BOOL almost_eq(float f1, float f2)
return f1 < 0.0001;
}
+static void test_Ctraits_math_functions(void)
+{
+ BYTE ret;
+
+ ret = p_std_Ctraits_float__Isnan(0.0);
+ ok(ret == FALSE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_float__Isnan(0.0 / 0.0);
+ ok(ret == TRUE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_float__Isnan(1.0 / 0.0);
+ ok(ret == FALSE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_float__Isnan(-1.0 / 0.0);
+ ok(ret == FALSE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_float__Isnan(log(-1.0));
+ ok(ret == TRUE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_float__Isnan(sqrt(-1.0));
+ ok(ret == TRUE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_double__Isnan(3.14159 / 0.0);
+ ok(ret == FALSE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_double__Isnan(log(-3.14159));
+ ok(ret == TRUE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_long_double__Isnan(3.14159 / 0.0);
+ ok(ret == FALSE, "ret = %d\n", ret);
+
+ ret = p_std_Ctraits_long_double__Isnan(sqrt(-3.14159));
+ ok(ret == TRUE, "ret = %d\n", ret);
+}
+
static void test_complex(void)
{
complex_float c1, c2, c3;
@@ -935,6 +982,7 @@ START_TEST(misc)
test_virtual_call();
test_virtual_base_dtors();
test_allocator_char();
+ test_Ctraits_math_functions();
test_complex();
ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n");
More information about the wine-cvs
mailing list