Piotr Caban : msvcp: Add _Dscale implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 2 09:21:48 CDT 2015


Module: wine
Branch: master
Commit: 643ff988c43e4cb40387a71086f6ad81953491bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=643ff988c43e4cb40387a71086f6ad81953491bb

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Oct  1 18:42:29 2015 +0200

msvcp: Add _Dscale implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>

---

 dlls/msvcp100/msvcp100.spec         |  6 ++---
 dlls/msvcp110/msvcp110.spec         |  6 ++---
 dlls/msvcp120/msvcp120.spec         |  6 ++---
 dlls/msvcp120/tests/msvcp120.c      | 54 +++++++++++++++++++++++++++++++++++++
 dlls/msvcp120_app/msvcp120_app.spec |  6 ++---
 dlls/msvcp60/msvcp60.spec           |  6 ++---
 dlls/msvcp70/msvcp70.spec           |  6 ++---
 dlls/msvcp71/msvcp71.spec           |  6 ++---
 dlls/msvcp80/msvcp80.spec           |  6 ++---
 dlls/msvcp90/math.c                 | 14 ++++++++++
 dlls/msvcp90/msvcp90.spec           |  6 ++---
 11 files changed, 95 insertions(+), 27 deletions(-)

diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec
index 6738979..c5d8fcc 100644
--- a/dlls/msvcp100/msvcp100.spec
+++ b/dlls/msvcp100/msvcp100.spec
@@ -2891,14 +2891,14 @@
 @ stub _Cosh
 @ extern _Denorm
 @ stub _Dnorm
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ cdecl _Dtest(ptr)
 @ extern _Eps
 @ stub _Exp
 @ stub _FCosh
 @ extern _FDenorm
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ cdecl _FDtest(ptr)
 @ extern _FEps
 @ stub _FExp
@@ -2919,7 +2919,7 @@
 @ extern _Inf
 @ stub _LCosh
 @ extern _LDenorm
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ cdecl _LDtest(ptr) _Dtest
 @ extern _LEps
 @ stub _LExp
diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index f571a55..a3776cf 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -3743,7 +3743,7 @@
 @ stub _Dint
 @ stub _Dnorm
 @ cdecl _Do_call(ptr)
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ stub _Dtento
 @ cdecl _Dtest(ptr)
 @ stub _Dunscale
@@ -3753,7 +3753,7 @@
 @ extern _FDenorm
 @ stub _FDint
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ stub _FDtento
 @ cdecl _FDtest(ptr)
 @ stub _FDunscale
@@ -3789,7 +3789,7 @@
 @ stub _LCosh
 @ extern _LDenorm
 @ stub _LDint
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ stub _LDtento
 @ cdecl _LDtest(ptr) _Dtest
 @ stub _LDunscale
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 8da3cc7..2b07f13 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -3684,7 +3684,7 @@
 @ stub _Dint
 @ stub _Dnorm
 @ cdecl _Do_call(ptr)
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ stub _Dtento
 @ cdecl _Dtest(ptr)
 @ stub _Dunscale
@@ -3694,7 +3694,7 @@
 @ extern _FDenorm
 @ stub _FDint
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ stub _FDtento
 @ cdecl _FDtest(ptr)
 @ stub _FDunscale
@@ -3732,7 +3732,7 @@
 @ stub _LCosh
 @ extern _LDenorm
 @ stub _LDint
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ stub _LDtento
 @ cdecl _LDtest(ptr) _Dtest
 @ stub _LDunscale
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index bf7ed8f..358c408 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -86,6 +86,7 @@ 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);
+static short (__cdecl *p__Dscale)(double *d, int exp);
 
 /* filesystem */
 static ULONGLONG(__cdecl *p_tr2_sys__File_size)(char const*);
@@ -139,6 +140,8 @@ static BOOL init(void)
             "_Do_call");
     SET(p__Dtest,
             "_Dtest");
+    SET(p__Dscale,
+            "_Dscale");
     if(sizeof(void*) == 8) { /* 64-bit initialization */
         SET(p_tr2_sys__File_size,
                 "?_File_size at sys@tr2 at std@@YA_KPEBD at Z");
@@ -461,6 +464,56 @@ static void test__Dtest(void)
     ok(ret == FP_NAN, "_Dtest(NAN) returned %x\n", ret);
 }
 
+static void test__Dscale(void)
+{
+    double d;
+    short ret;
+
+    d = 0;
+    ret = p__Dscale(&d, 0);
+    ok(d == 0, "d = %f\n", d);
+    ok(ret == FP_ZERO, "ret = %x\n", ret);
+
+    d = 0;
+    ret = p__Dscale(&d, 1);
+    ok(d == 0, "d = %f\n", d);
+    ok(ret == FP_ZERO, "ret = %x\n", ret);
+
+    d = 0;
+    ret = p__Dscale(&d, -1);
+    ok(d == 0, "d = %f\n", d);
+    ok(ret == FP_ZERO, "ret = %x\n", ret);
+
+    d = 1;
+    ret = p__Dscale(&d, 0);
+    ok(d == 1, "d = %f\n", d);
+    ok(ret == FP_NORMAL, "ret = %x\n", ret);
+
+    d = 1;
+    ret = p__Dscale(&d, 1);
+    ok(d == 2, "d = %f\n", d);
+    ok(ret == FP_NORMAL, "ret = %x\n", ret);
+
+    d = 1;
+    ret = p__Dscale(&d, -1);
+    ok(d == 0.5, "d = %f\n", d);
+    ok(ret == FP_NORMAL, "ret = %x\n", ret);
+
+    d = 1;
+    ret = p__Dscale(&d, -99999);
+    ok(d == 0, "d = %f\n", d);
+    ok(ret == FP_ZERO, "ret = %x\n", ret);
+
+    d = 1;
+    ret = p__Dscale(&d, 999999);
+    ok(d == INFINITY, "d = %f\n", d);
+    ok(ret == FP_INFINITE, "ret = %x\n", ret);
+
+    d = NAN;
+    ret = p__Dscale(&d, 1);
+    ok(ret == FP_NAN, "ret = %x\n", ret);
+}
+
 static void test_tr2_sys__File_size(void)
 {
     ULONGLONG val;
@@ -1001,6 +1054,7 @@ START_TEST(msvcp120)
     test__Call_once();
     test__Do_call();
     test__Dtest();
+    test__Dscale();
 
     test_tr2_sys__File_size();
     test_tr2_sys__Equivalent();
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index bf7b542..1470b3c 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -3684,7 +3684,7 @@
 @ stub _Dint
 @ stub _Dnorm
 @ cdecl _Do_call(ptr) msvcp120._Do_call
-@ stub _Dscale
+@ cdecl _Dscale(ptr long) msvcp120._Dscale
 @ stub _Dtento
 @ cdecl _Dtest(ptr) msvcp120._Dtest
 @ stub _Dunscale
@@ -3694,7 +3694,7 @@
 @ extern _FDenorm msvcp120._FDenorm
 @ stub _FDint
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long) msvcp120._FDscale
 @ stub _FDtento
 @ cdecl _FDtest(ptr) msvcp120._FDtest
 @ stub _FDunscale
@@ -3732,7 +3732,7 @@
 @ stub _LCosh
 @ extern _LDenorm msvcp120._LDenorm
 @ stub _LDint
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) msvcp120._LDscale
 @ stub _LDtento
 @ cdecl _LDtest(ptr) msvcp120._LDtest
 @ stub _LDunscale
diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec
index 10d04e5..05d0435 100644
--- a/dlls/msvcp60/msvcp60.spec
+++ b/dlls/msvcp60/msvcp60.spec
@@ -4257,14 +4257,14 @@
 @ stub _Cosh
 @ extern _Denorm _Denorm
 @ stub _Dnorm
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ cdecl _Dtest(ptr)
 @ extern _Eps _Eps
 @ stub _Exp
 @ stub _FCosh
 @ extern _FDenorm _FDenorm
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ cdecl _FDtest(ptr)
 @ extern _FEps _FEps
 @ stub _FExp
@@ -4281,7 +4281,7 @@
 @ extern _Inf _Inf
 @ stub _LCosh
 @ extern _LDenorm _LDenorm
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ cdecl _LDtest(ptr) _Dtest
 @ extern _LEps _LEps
 @ stub _LExp
diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec
index f390d8a..a6f5ef3 100644
--- a/dlls/msvcp70/msvcp70.spec
+++ b/dlls/msvcp70/msvcp70.spec
@@ -5043,14 +5043,14 @@
 @ stub _Cosh
 @ extern _Denorm
 @ stub _Dnorm
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ cdecl _Dtest(ptr)
 @ extern _Eps
 @ stub _Exp
 @ stub _FCosh
 @ extern _FDenorm
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ cdecl _FDtest(ptr)
 @ extern _FEps
 @ stub _FExp
@@ -5068,7 +5068,7 @@
 @ extern _Inf
 @ stub _LCosh
 @ extern _LDenorm
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ cdecl _LDtest(ptr) _Dtest
 @ extern _LEps
 @ stub _LExp
diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec
index 2675c9a..ba2fcaf 100644
--- a/dlls/msvcp71/msvcp71.spec
+++ b/dlls/msvcp71/msvcp71.spec
@@ -5097,14 +5097,14 @@
 @ stub _Cosh
 @ extern _Denorm
 @ stub _Dnorm
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ cdecl _Dtest(ptr)
 @ extern _Eps
 @ stub _Exp
 @ stub _FCosh
 @ extern _FDenorm
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ cdecl _FDtest(ptr)
 @ extern _FEps
 @ stub _FExp
@@ -5124,7 +5124,7 @@
 @ extern _Inf
 @ stub _LCosh
 @ extern _LDenorm
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ cdecl _LDtest(ptr) _Dtest
 @ extern _LEps
 @ stub _LExp
diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec
index ed04def..d801608 100644
--- a/dlls/msvcp80/msvcp80.spec
+++ b/dlls/msvcp80/msvcp80.spec
@@ -5703,7 +5703,7 @@
 @ stub _Cosh
 @ extern _Denorm
 @ stub _Dnorm
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ stub _Dtentox
 @ cdecl _Dtest(ptr)
 @ stub _Dunscale
@@ -5712,7 +5712,7 @@
 @ stub _FCosh
 @ extern _FDenorm
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ stub _FDtentox
 @ cdecl _FDtest(ptr)
 @ stub _FDunscale
@@ -5734,7 +5734,7 @@
 @ extern _Inf
 @ stub _LCosh
 @ extern _LDenorm
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ stub _LDtentox
 @ cdecl _LDtest(ptr) _Dtest
 @ stub _LDunscale
diff --git a/dlls/msvcp90/math.c b/dlls/msvcp90/math.c
index 9b827f3..2d9996db 100644
--- a/dlls/msvcp90/math.c
+++ b/dlls/msvcp90/math.c
@@ -2260,3 +2260,17 @@ short __cdecl _FDtest(float *x)
 {
     return dclass(*x);
 }
+
+/* _Dscale */
+short __cdecl _Dscale(double *x, int exp)
+{
+    *x *= pow(2, exp);
+    return dclass(*x);
+}
+
+/* _FDscale */
+short __cdecl _FDscale(float *x, int exp)
+{
+    *x *= pow(2, exp);
+    return dclass(*x);
+}
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index d3a314b..f2e3a5b 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -6479,14 +6479,14 @@
 @ stub _Cosh
 @ extern _Denorm
 @ stub _Dnorm
-@ stub _Dscale
+@ cdecl _Dscale(ptr long)
 @ cdecl _Dtest(ptr)
 @ extern _Eps
 @ stub _Exp
 @ stub _FCosh
 @ extern _FDenorm
 @ stub _FDnorm
-@ stub _FDscale
+@ cdecl _FDscale(ptr long)
 @ cdecl _FDtest(ptr)
 @ extern _FEps
 @ stub _FExp
@@ -6506,7 +6506,7 @@
 @ extern _Inf
 @ stub _LCosh
 @ extern _LDenorm
-@ stub _LDscale
+@ cdecl _LDscale(ptr long) _Dscale
 @ cdecl _LDtest(ptr) _Dtest
 @ extern _LEps
 @ stub _LExp




More information about the wine-cvs mailing list