Module: wine Branch: master Commit: 3e9db55b09174db2b601c1bb19f5abb7f5cadcdd URL: http://source.winehq.org/git/wine.git/?a=commit;h=3e9db55b09174db2b601c1bb19... Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Jan 24 12:27:57 2013 +0100 msvcp90: Added std::abs(complex) implementation. --- dlls/msvcp90/math.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ dlls/msvcp90/msvcp90.spec | 24 +++++++++--------- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/dlls/msvcp90/math.c b/dlls/msvcp90/math.c index 8d25e76..37dc3f7 100644 --- a/dlls/msvcp90/math.c +++ b/dlls/msvcp90/math.c @@ -1276,6 +1276,33 @@ float __thiscall complex_float_real_get(const complex_float *this) return this->real; } +/* ??$_Fabs(a)M@std@@YAMABV?$complex(a)M@0(a)PAH@Z */ +/* ??$_Fabs(a)M@std@@YAMAEBV?$complex(a)M@0(a)PEAH@Z */ +float __cdecl complex_float__Fabs(const complex_float *c, int *scale) +{ + float ret; + + ret = hypotf(c->real, c->imag); + if(_isnan(ret) || ret==0) { + *scale = 0; + }else if(ret >= 1) { + *scale = 2; + ret /= 4; + }else { + *scale = -2; + ret *= 4; + } + + return ret; +} + +/* ??$abs(a)M@std@@YAMABV?$complex(a)M@0@@Z */ +/* ??$abs(a)M@std@@YAMAEBV?$complex(a)M@0@@Z */ +float __cdecl complex_float_abs(const complex_float *c) +{ + return hypotf(c->real, c->imag); +} + /* ??0?$_Complex_base(a)NU_C_double_complex@@@std@@QAE(a)ABN0@Z */ /* ??0?$_Complex_base(a)NU_C_double_complex@@@std@@QEAA(a)AEBN0@Z */ /* ??0?$_Complex_base(a)OU_C_ldouble_complex@@@std@@QAE(a)ABO0@Z */ @@ -1742,3 +1769,34 @@ double __thiscall complex_double_real_get(const complex_double *this) { return this->real; } + +/* ??$_Fabs(a)N@std@@YANABV?$complex(a)N@0(a)PAH@Z */ +/* ??$_Fabs(a)N@std@@YANAEBV?$complex(a)N@0(a)PEAH@Z */ +/* ??$_Fabs(a)O@std@@YAOABV?$complex(a)O@0(a)PAH@Z */ +/* ??$_Fabs(a)O@std@@YAOAEBV?$complex(a)O@0(a)PEAH@Z */ +double __cdecl complex_double__Fabs(const complex_double *c, int *scale) +{ + double ret; + + ret = hypot(c->real, c->imag); + if(_isnan(ret) || ret==0) { + *scale = 0; + }else if(ret >= 1) { + *scale = 2; + ret /= 4; + }else { + *scale = -2; + ret *= 4; + } + + return ret; +} + +/* ??$abs(a)N@std@@YANABV?$complex(a)N@0@@Z */ +/* ??$abs(a)N@std@@YANAEBV?$complex(a)N@0@@Z */ +/* ??$abs(a)O@std@@YAOABV?$complex(a)O@0@@Z */ +/* ??$abs(a)O@std@@YAOAEBV?$complex(a)O@0@@Z */ +double __cdecl complex_double_abs(const complex_double *c) +{ + return hypot(c->real, c->imag); +} diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec index 14540b4..ef4726d 100644 --- a/dlls/msvcp90/msvcp90.spec +++ b/dlls/msvcp90/msvcp90.spec @@ -344,18 +344,18 @@ @ cdecl -arch=win64 ??$?P_WU?$char_traits(a)_W@std@@V?$allocator(a)_W@1@@std@@YA_NAEBV?$basic_string(a)_WU?$char_traits(a)_W@std@@V?$allocator(a)_W@2@@0(a)PEB_W@Z(ptr wstr) MSVCP_basic_string_wchar_geq_bstr_cstr @ cdecl -arch=win32 ??$?P_WU?$char_traits(a)_W@std@@V?$allocator(a)_W@1@@std@@YA_NPB_WABV?$basic_string(a)_WU?$char_traits(a)_W@std@@V?$allocator(a)_W@2@@0@@Z(wstr ptr) MSVCP_basic_string_wchar_geq_cstr_bstr @ cdecl -arch=win64 ??$?P_WU?$char_traits(a)_W@std@@V?$allocator(a)_W@1@@std@@YA_NPEB_WAEBV?$basic_string(a)_WU?$char_traits(a)_W@std@@V?$allocator(a)_W@2@@0@@Z(wstr ptr) MSVCP_basic_string_wchar_geq_cstr_bstr -@ stub -arch=win32 ??$_Fabs(a)M@std@@YAMABV?$complex(a)M@0(a)PAH@Z -@ stub -arch=win64 ??$_Fabs(a)M@std@@YAMAEBV?$complex(a)M@0(a)PEAH@Z -@ stub -arch=win32 ??$_Fabs(a)N@std@@YANABV?$complex(a)N@0(a)PAH@Z -@ stub -arch=win64 ??$_Fabs(a)N@std@@YANAEBV?$complex(a)N@0(a)PEAH@Z -@ stub -arch=win32 ??$_Fabs(a)O@std@@YAOABV?$complex(a)O@0(a)PAH@Z -@ stub -arch=win64 ??$_Fabs(a)O@std@@YAOAEBV?$complex(a)O@0(a)PEAH@Z -@ stub -arch=win32 ??$abs(a)M@std@@YAMABV?$complex(a)M@0@@Z -@ stub -arch=win64 ??$abs(a)M@std@@YAMAEBV?$complex(a)M@0@@Z -@ stub -arch=win32 ??$abs(a)N@std@@YANABV?$complex(a)N@0@@Z -@ stub -arch=win64 ??$abs(a)N@std@@YANAEBV?$complex(a)N@0@@Z -@ stub -arch=win32 ??$abs(a)O@std@@YAOABV?$complex(a)O@0@@Z -@ stub -arch=win64 ??$abs(a)O@std@@YAOAEBV?$complex(a)O@0@@Z +@ cdecl -arch=win32 ??$_Fabs(a)M@std@@YAMABV?$complex(a)M@0(a)PAH@Z(ptr ptr) complex_float__Fabs +@ cdecl -arch=win64 ??$_Fabs(a)M@std@@YAMAEBV?$complex(a)M@0(a)PEAH@Z(ptr ptr) complex_float__Fabs +@ cdecl -arch=win32 ??$_Fabs(a)N@std@@YANABV?$complex(a)N@0(a)PAH@Z(ptr ptr) complex_double__Fabs +@ cdecl -arch=win64 ??$_Fabs(a)N@std@@YANAEBV?$complex(a)N@0(a)PEAH@Z(ptr ptr) complex_double__Fabs +@ cdecl -arch=win32 ??$_Fabs(a)O@std@@YAOABV?$complex(a)O@0(a)PAH@Z(ptr ptr) complex_double__Fabs +@ cdecl -arch=win64 ??$_Fabs(a)O@std@@YAOAEBV?$complex(a)O@0(a)PEAH@Z(ptr ptr) complex_double__Fabs +@ cdecl -arch=win32 ??$abs(a)M@std@@YAMABV?$complex(a)M@0@@Z(ptr) complex_float_abs +@ cdecl -arch=win64 ??$abs(a)M@std@@YAMAEBV?$complex(a)M@0@@Z(ptr) complex_float_abs +@ cdecl -arch=win32 ??$abs(a)N@std@@YANABV?$complex(a)N@0@@Z(ptr) complex_double_abs +@ cdecl -arch=win64 ??$abs(a)N@std@@YANAEBV?$complex(a)N@0@@Z(ptr) complex_double_abs +@ cdecl -arch=win32 ??$abs(a)O@std@@YAOABV?$complex(a)O@0@@Z(ptr) complex_double_abs +@ cdecl -arch=win64 ??$abs(a)O@std@@YAOAEBV?$complex(a)O@0@@Z(ptr) complex_double_abs @ cdecl -arch=win32 ??$arg(a)M@std@@YAMABV?$complex(a)M@0@@Z(ptr) complex_float_arg @ cdecl -arch=win64 ??$arg(a)M@std@@YAMAEBV?$complex(a)M@0@@Z(ptr) complex_float_arg @ cdecl -arch=win32 ??$arg(a)N@std@@YANABV?$complex(a)N@0@@Z(ptr) complex_double_arg