Piotr Caban : msvcp90: Added std::pow(complex) and std::sqrt(complex) implementation.

Alexandre Julliard julliard at winehq.org
Fri Jan 25 13:31:48 CST 2013


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Jan 25 10:37:39 2013 +0100

msvcp90: Added std::pow(complex) and std::sqrt(complex) implementation.

---

 dlls/msvcp90/math.c       |   90 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/msvcp90/msvcp90.spec |   48 ++++++++++++------------
 2 files changed, 114 insertions(+), 24 deletions(-)

diff --git a/dlls/msvcp90/math.c b/dlls/msvcp90/math.c
index 7cd605a..e049d69 100644
--- a/dlls/msvcp90/math.c
+++ b/dlls/msvcp90/math.c
@@ -1427,6 +1427,47 @@ complex_float* __cdecl complex_float_polar(complex_float *ret, const float *mod)
     return ret;
 }
 
+/* ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@0 at Z */
+/* ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@0 at Z */
+complex_float* __cdecl complex_float_pow(complex_float *ret, const complex_float *l, const complex_float *r)
+{
+    float abs = complex_float_abs(l), arg = complex_float_arg(l);
+    float rad = pow(abs, r->real), theta = r->real*arg;
+
+    if(r->imag) {
+        rad *= exp(-r->imag * arg);
+        theta += r->imag * log(abs);
+    }
+
+    ret->real = rad * cos(theta);
+    ret->imag = rad * sin(theta);
+    return ret;
+}
+
+/* ??$pow at M@std@@YA?AV?$complex at M@0 at ABMABV10@@Z */
+/* ??$pow at M@std@@YA?AV?$complex at M@0 at AEBMAEBV10@@Z */
+complex_float* __cdecl complex_float_pow_fc(complex_float *ret, const float *l, const complex_float *r)
+{
+    complex_float c = { *l, 0 };
+    return complex_float_pow(ret, &c, r);
+}
+
+/* ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@ABM at Z */
+/* ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@AEBM at Z */
+complex_float* __cdecl complex_float_pow_cf(complex_float *ret, const complex_float *l, const float *r)
+{
+    complex_float c = { *r, 0 };
+    return complex_float_pow(ret, l, &c);
+}
+
+/* ??$sqrt at M@std@@YA?AV?$complex at M@0 at ABV10@@Z */
+/* ??$sqrt at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z */
+complex_float* __cdecl complex_float_sqrt(complex_float *ret, const complex_float *l)
+{
+    complex_float c = { 0.5, 0 };
+    return complex_float_pow(ret, l, &c);
+}
+
 /* ??0?$_Complex_base at NU_C_double_complex@@@std@@QAE at ABN0@Z */
 /* ??0?$_Complex_base at NU_C_double_complex@@@std@@QEAA at AEBN0@Z */
 /* ??0?$_Complex_base at OU_C_ldouble_complex@@@std@@QAE at ABO0@Z */
@@ -2073,3 +2114,52 @@ complex_double* __cdecl complex_double_polar(complex_double *ret, const double *
     ret->imag = 0;
     return ret;
 }
+
+/* ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@0 at Z */
+/* ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@0 at Z */
+/* ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@0 at Z */
+/* ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@0 at Z */
+complex_double* __cdecl complex_double_pow(complex_double *ret, const complex_double *l, const complex_double *r)
+{
+    double abs = complex_double_abs(l), arg = complex_double_arg(l);
+    double rad = pow(abs, r->real), theta = r->real*arg;
+
+    if(r->imag) {
+        rad *= exp(-r->imag * arg);
+        theta += r->imag * log(abs);
+    }
+
+    ret->real = rad * cos(theta);
+    ret->imag = rad * sin(theta);
+    return ret;
+}
+
+/* ??$pow at N@std@@YA?AV?$complex at N@0 at ABNABV10@@Z */
+/* ??$pow at N@std@@YA?AV?$complex at N@0 at AEBNAEBV10@@Z */
+/* ??$pow at O@std@@YA?AV?$complex at O@0 at ABOABV10@@Z */
+/* ??$pow at O@std@@YA?AV?$complex at O@0 at AEBOAEBV10@@Z */
+complex_double* __cdecl complex_double_pow_dc(complex_double *ret, const double *l, const complex_double *r)
+{
+    complex_double c = { *l, 0 };
+    return complex_double_pow(ret, &c, r);
+}
+
+/* ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@ABN at Z */
+/* ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@AEBN at Z */
+/* ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@ABO at Z */
+/* ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@AEBO at Z */
+complex_double* __cdecl complex_double_pow_cd(complex_double *ret, const complex_double *l, const double *r)
+{
+    complex_double c = { *r, 0 };
+    return complex_double_pow(ret, l, &c);
+}
+
+/* ??$sqrt at N@std@@YA?AV?$complex at N@0 at ABV10@@Z */
+/* ??$sqrt at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z */
+/* ??$sqrt at O@std@@YA?AV?$complex at O@0 at ABV10@@Z */
+/* ??$sqrt at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z */
+complex_double* __cdecl complex_double_sqrt(complex_double *ret, const complex_double *l)
+{
+    complex_double c = { 0.5, 0 };
+    return complex_double_pow(ret, l, &c);
+}
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index c1351d5..e73f51a 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -434,28 +434,28 @@
 @ cdecl -arch=win64 ??$polar at O@std@@YA?AV?$complex at O@0 at AEBO0@Z(ptr ptr ptr) complex_double_polar_theta
 @ cdecl -arch=win32 ??$polar at O@std@@YA?AV?$complex at O@0 at ABO@Z(ptr ptr) complex_double_polar
 @ cdecl -arch=win64 ??$polar at O@std@@YA?AV?$complex at O@0 at AEBO@Z(ptr ptr) complex_double_polar
-@ stub -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABMABV10@@Z
-@ stub -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBMAEBV10@@Z
-@ stub -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@0 at Z
-@ stub -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@0 at Z
-@ stub -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@ABM at Z
-@ stub -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@AEBM at Z
+@ cdecl -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABMABV10@@Z(ptr ptr ptr) complex_float_pow_fc
+@ cdecl -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBMAEBV10@@Z(ptr ptr ptr) complex_float_pow_fc
+@ cdecl -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@0 at Z(ptr ptr ptr) complex_float_pow
+@ cdecl -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@0 at Z(ptr ptr ptr) complex_float_pow
+@ cdecl -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@ABM at Z(ptr ptr ptr) complex_float_pow_cf
+@ cdecl -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@AEBM at Z(ptr ptr ptr) complex_float_pow_cf
 @ stub -arch=win32 ??$pow at M@std@@YA?AV?$complex at M@0 at ABV10@H at Z
 @ stub -arch=win64 ??$pow at M@std@@YA?AV?$complex at M@0 at AEBV10@H at Z
-@ stub -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABNABV10@@Z
-@ stub -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBNAEBV10@@Z
-@ stub -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@0 at Z
-@ stub -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@0 at Z
-@ stub -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@ABN at Z
-@ stub -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@AEBN at Z
+@ cdecl -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABNABV10@@Z(ptr ptr ptr) complex_double_pow_dc
+@ cdecl -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBNAEBV10@@Z(ptr ptr ptr) complex_double_pow_dc
+@ cdecl -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@0 at Z(ptr ptr ptr) complex_double_pow
+@ cdecl -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@0 at Z(ptr ptr ptr) complex_double_pow
+@ cdecl -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@ABN at Z(ptr ptr ptr) complex_double_pow_cd
+@ cdecl -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@AEBN at Z(ptr ptr ptr) complex_double_pow_cd
 @ stub -arch=win32 ??$pow at N@std@@YA?AV?$complex at N@0 at ABV10@H at Z
 @ stub -arch=win64 ??$pow at N@std@@YA?AV?$complex at N@0 at AEBV10@H at Z
-@ stub -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABOABV10@@Z
-@ stub -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBOAEBV10@@Z
-@ stub -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@0 at Z
-@ stub -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@0 at Z
-@ stub -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@ABO at Z
-@ stub -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@AEBO at Z
+@ cdecl -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABOABV10@@Z(ptr ptr ptr) complex_double_pow_dc
+@ cdecl -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBOAEBV10@@Z(ptr ptr ptr) complex_double_pow_dc
+@ cdecl -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@0 at Z(ptr ptr ptr) complex_double_pow
+@ cdecl -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@0 at Z(ptr ptr ptr) complex_double_pow
+@ cdecl -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@ABO at Z(ptr ptr ptr) complex_double_pow_cd
+@ cdecl -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@AEBO at Z(ptr ptr ptr) complex_double_pow_cd
 @ stub -arch=win32 ??$pow at O@std@@YA?AV?$complex at O@0 at ABV10@H at Z
 @ stub -arch=win64 ??$pow at O@std@@YA?AV?$complex at O@0 at AEBV10@H at Z
 @ cdecl -arch=win32 ??$real at M@std@@YAMABV?$complex at M@0@@Z(ptr) complex_float_real
@@ -476,12 +476,12 @@
 @ cdecl -arch=win64 ??$sinh at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z(ptr ptr) complex_double_sinh
 @ cdecl -arch=win32 ??$sinh at O@std@@YA?AV?$complex at O@0 at ABV10@@Z(ptr ptr) complex_double_sinh
 @ cdecl -arch=win64 ??$sinh at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z(ptr ptr) complex_double_sinh
-@ stub -arch=win32 ??$sqrt at M@std@@YA?AV?$complex at M@0 at ABV10@@Z
-@ stub -arch=win64 ??$sqrt at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z
-@ stub -arch=win32 ??$sqrt at N@std@@YA?AV?$complex at N@0 at ABV10@@Z
-@ stub -arch=win64 ??$sqrt at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z
-@ stub -arch=win32 ??$sqrt at O@std@@YA?AV?$complex at O@0 at ABV10@@Z
-@ stub -arch=win64 ??$sqrt at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z
+@ cdecl -arch=win32 ??$sqrt at M@std@@YA?AV?$complex at M@0 at ABV10@@Z(ptr ptr) complex_float_sqrt
+@ cdecl -arch=win64 ??$sqrt at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z(ptr ptr) complex_float_sqrt
+@ cdecl -arch=win32 ??$sqrt at N@std@@YA?AV?$complex at N@0 at ABV10@@Z(ptr ptr) complex_double_sqrt
+@ cdecl -arch=win64 ??$sqrt at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z(ptr ptr) complex_double_sqrt
+@ cdecl -arch=win32 ??$sqrt at O@std@@YA?AV?$complex at O@0 at ABV10@@Z(ptr ptr) complex_double_sqrt
+@ cdecl -arch=win64 ??$sqrt at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z(ptr ptr) complex_double_sqrt
 @ cdecl -arch=win32 ??$tan at M@std@@YA?AV?$complex at M@0 at ABV10@@Z(ptr ptr) complex_float_tan
 @ cdecl -arch=win64 ??$tan at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z(ptr ptr) complex_float_tan
 @ cdecl -arch=win32 ??$tan at N@std@@YA?AV?$complex at N@0 at ABV10@@Z(ptr ptr) complex_double_tan




More information about the wine-cvs mailing list