Piotr Caban : msvcp90: Added std::log(complex) and std::exp(complex) implementation.
Alexandre Julliard
julliard at winehq.org
Fri Jan 25 13:31:48 CST 2013
Module: wine
Branch: master
Commit: 55aeaf3c7680146a5bf7df05b19a2427904bdfad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=55aeaf3c7680146a5bf7df05b19a2427904bdfad
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Jan 25 10:36:51 2013 +0100
msvcp90: Added std::log(complex) and std::exp(complex) implementation.
---
dlls/msvcp90/math.c | 65 +++++++++++++++++++++++++++++++++++++++++++++
dlls/msvcp90/msvcp90.spec | 36 ++++++++++++------------
include/msvcrt/math.h | 19 +++++++++++++
3 files changed, 102 insertions(+), 18 deletions(-)
diff --git a/dlls/msvcp90/math.c b/dlls/msvcp90/math.c
index 72a8922..aca11f1 100644
--- a/dlls/msvcp90/math.c
+++ b/dlls/msvcp90/math.c
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <limits.h>
#include <float.h>
+#define _USE_MATH_DEFINES
#include <math.h>
#include "msvcp90.h"
@@ -1372,6 +1373,35 @@ complex_float* __cdecl complex_float_tanh(complex_float *ret, const complex_floa
return ret;
}
+/* ??$exp at M@std@@YA?AV?$complex at M@0 at ABV10@@Z */
+/* ??$exp at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z */
+complex_float* __cdecl complex_float_exp(complex_float *ret, const complex_float *c)
+{
+ ret->real = ret->imag = exp(c->real);
+ ret->real *= cos(c->imag);
+ ret->imag *= sin(c->imag);
+ return ret;
+}
+
+/* ??$log at M@std@@YA?AV?$complex at M@0 at ABV10@@Z */
+/* ??$log at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z */
+complex_float* __cdecl complex_float_log(complex_float *ret, const complex_float *c)
+{
+ ret->real = log(complex_float_abs(c));
+ ret->imag = complex_float_arg(c);
+ return ret;
+}
+
+/* ??$log10 at M@std@@YA?AV?$complex at M@0 at ABV10@@Z */
+/* ??$log10 at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z */
+complex_float* __cdecl complex_float_log10(complex_float *ret, const complex_float *c)
+{
+ complex_float_log(ret, c);
+ ret->real *= M_LOG10E;
+ ret->imag *= M_LOG10E;
+ return ret;
+}
+
/* ??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 */
@@ -1952,3 +1982,38 @@ complex_double* __cdecl complex_double_tanh(complex_double *ret, const complex_d
ret->imag = -tmp.real;
return ret;
}
+
+/* ??$exp at N@std@@YA?AV?$complex at N@0 at ABV10@@Z */
+/* ??$exp at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z */
+/* ??$exp at O@std@@YA?AV?$complex at O@0 at ABV10@@Z */
+/* ??$exp at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z */
+complex_double* __cdecl complex_double_exp(complex_double *ret, const complex_double *c)
+{
+ ret->real = ret->imag = exp(c->real);
+ ret->real *= cos(c->imag);
+ ret->imag *= sin(c->imag);
+ return ret;
+}
+
+/* ??$log at N@std@@YA?AV?$complex at N@0 at ABV10@@Z */
+/* ??$log at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z */
+/* ??$log at O@std@@YA?AV?$complex at O@0 at ABV10@@Z */
+/* ??$log at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z */
+complex_double* __cdecl complex_double_log(complex_double *ret, const complex_double *c)
+{
+ ret->real = log(complex_double_abs(c));
+ ret->imag = complex_double_arg(c);
+ return ret;
+}
+
+/* ??$log10 at N@std@@YA?AV?$complex at N@0 at ABV10@@Z */
+/* ??$log10 at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z */
+/* ??$log10 at O@std@@YA?AV?$complex at O@0 at ABV10@@Z */
+/* ??$log10 at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z */
+complex_double* __cdecl complex_double_log10(complex_double *ret, const complex_double *c)
+{
+ complex_double_log(ret, c);
+ ret->real *= M_LOG10E;
+ ret->imag *= M_LOG10E;
+ return ret;
+}
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index b77fcf5..61a4651 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -380,12 +380,12 @@
@ cdecl -arch=win64 ??$cosh at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z(ptr ptr) complex_double_cosh
@ cdecl -arch=win32 ??$cosh at O@std@@YA?AV?$complex at O@0 at ABV10@@Z(ptr ptr) complex_double_cosh
@ cdecl -arch=win64 ??$cosh at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z(ptr ptr) complex_double_cosh
-@ stub -arch=win32 ??$exp at M@std@@YA?AV?$complex at M@0 at ABV10@@Z
-@ stub -arch=win64 ??$exp at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z
-@ stub -arch=win32 ??$exp at N@std@@YA?AV?$complex at N@0 at ABV10@@Z
-@ stub -arch=win64 ??$exp at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z
-@ stub -arch=win32 ??$exp at O@std@@YA?AV?$complex at O@0 at ABV10@@Z
-@ stub -arch=win64 ??$exp at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z
+@ cdecl -arch=win32 ??$exp at M@std@@YA?AV?$complex at M@0 at ABV10@@Z(ptr ptr) complex_float_exp
+@ cdecl -arch=win64 ??$exp at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z(ptr ptr) complex_float_exp
+@ cdecl -arch=win32 ??$exp at N@std@@YA?AV?$complex at N@0 at ABV10@@Z(ptr ptr) complex_double_exp
+@ cdecl -arch=win64 ??$exp at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z(ptr ptr) complex_double_exp
+@ cdecl -arch=win32 ??$exp at O@std@@YA?AV?$complex at O@0 at ABV10@@Z(ptr ptr) complex_double_exp
+@ cdecl -arch=win64 ??$exp at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z(ptr ptr) complex_double_exp
@ cdecl -arch=win32 ??$getline at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@YAAAV?$basic_istream at DU?$char_traits at D@std@@@0 at AAV10@AAV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@0@@Z(ptr ptr) basic_istream_char_getline_bstr
@ cdecl -arch=win64 ??$getline at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@YAAEAV?$basic_istream at DU?$char_traits at D@std@@@0 at AEAV10@AEAV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@0@@Z(ptr ptr) basic_istream_char_getline_bstr
@ cdecl -arch=win32 ??$getline at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@YAAAV?$basic_istream at DU?$char_traits at D@std@@@0 at AAV10@AAV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@0 at D@Z(ptr ptr long) basic_istream_char_getline_bstr_delim
@@ -404,18 +404,18 @@
@ cdecl -arch=win64 ??$imag at N@std@@YANAEBV?$complex at N@0@@Z(ptr) complex_double_imag
@ cdecl -arch=win32 ??$imag at O@std@@YAOABV?$complex at O@0@@Z(ptr) complex_double_imag
@ cdecl -arch=win64 ??$imag at O@std@@YAOAEBV?$complex at O@0@@Z(ptr) complex_double_imag
-@ stub -arch=win32 ??$log10 at M@std@@YA?AV?$complex at M@0 at ABV10@@Z
-@ stub -arch=win64 ??$log10 at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z
-@ stub -arch=win32 ??$log10 at N@std@@YA?AV?$complex at N@0 at ABV10@@Z
-@ stub -arch=win64 ??$log10 at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z
-@ stub -arch=win32 ??$log10 at O@std@@YA?AV?$complex at O@0 at ABV10@@Z
-@ stub -arch=win64 ??$log10 at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z
-@ stub -arch=win32 ??$log at M@std@@YA?AV?$complex at M@0 at ABV10@@Z
-@ stub -arch=win64 ??$log at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z
-@ stub -arch=win32 ??$log at N@std@@YA?AV?$complex at N@0 at ABV10@@Z
-@ stub -arch=win64 ??$log at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z
-@ stub -arch=win32 ??$log at O@std@@YA?AV?$complex at O@0 at ABV10@@Z
-@ stub -arch=win64 ??$log at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z
+@ cdecl -arch=win32 ??$log10 at M@std@@YA?AV?$complex at M@0 at ABV10@@Z(ptr ptr) complex_float_log10
+@ cdecl -arch=win64 ??$log10 at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z(ptr ptr) complex_float_log10
+@ cdecl -arch=win32 ??$log10 at N@std@@YA?AV?$complex at N@0 at ABV10@@Z(ptr ptr) complex_double_log10
+@ cdecl -arch=win64 ??$log10 at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z(ptr ptr) complex_double_log10
+@ cdecl -arch=win32 ??$log10 at O@std@@YA?AV?$complex at O@0 at ABV10@@Z(ptr ptr) complex_double_log10
+@ cdecl -arch=win64 ??$log10 at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z(ptr ptr) complex_double_log10
+@ cdecl -arch=win32 ??$log at M@std@@YA?AV?$complex at M@0 at ABV10@@Z(ptr ptr) complex_float_log
+@ cdecl -arch=win64 ??$log at M@std@@YA?AV?$complex at M@0 at AEBV10@@Z(ptr ptr) complex_float_log
+@ cdecl -arch=win32 ??$log at N@std@@YA?AV?$complex at N@0 at ABV10@@Z(ptr ptr) complex_double_log
+@ cdecl -arch=win64 ??$log at N@std@@YA?AV?$complex at N@0 at AEBV10@@Z(ptr ptr) complex_double_log
+@ cdecl -arch=win32 ??$log at O@std@@YA?AV?$complex at O@0 at ABV10@@Z(ptr ptr) complex_double_log
+@ cdecl -arch=win64 ??$log at O@std@@YA?AV?$complex at O@0 at AEBV10@@Z(ptr ptr) complex_double_log
@ stub -arch=win32 ??$norm at M@std@@YAMABV?$complex at M@0@@Z
@ stub -arch=win64 ??$norm at M@std@@YAMAEBV?$complex at M@0@@Z
@ stub -arch=win32 ??$norm at N@std@@YANABV?$complex at N@0@@Z
diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h
index e99777d..4d0655e 100644
--- a/include/msvcrt/math.h
+++ b/include/msvcrt/math.h
@@ -152,4 +152,23 @@ static const union {
#include <poppack.h>
+#ifdef _USE_MATH_DEFINES
+#ifndef _MATH_DEFINES_DEFINED
+#define _MATH_DEFINES_DEFINED
+#define M_E 2.71828182845904523536
+#define M_LOG2E 1.44269504088896340736
+#define M_LOG10E 0.434294481903251827651
+#define M_LN2 0.693147180559945309417
+#define M_LN10 2.30258509299404568402
+#define M_PI 3.14159265358979323846
+#define M_PI_2 1.57079632679489661923
+#define M_PI_4 0.785398163397448309616
+#define M_1_PI 0.318309886183790671538
+#define M_2_PI 0.636619772367581343076
+#define M_2_SQRTPI 1.12837916709551257390
+#define M_SQRT2 1.41421356237309504880
+#define M_SQRT1_2 0.707106781186547524401
+#endif /* !_MATH_DEFINES_DEFINED */
+#endif /* _USE_MATH_DEFINES */
+
#endif /* __WINE_MATH_H */
More information about the wine-cvs
mailing list