This MR intends to add the complex numbers related functions: * cimag * _FCbuild * crealf * cimagf These functions are defined in dlls/msvcr120/math.c and mapped in dlls/msvcr120/msvcr120.spec and dlls/ucrbase/ucrbase.spec.
The related tests were added in dlls/mscr120/tests/msvcr120.c and result were checked.
-- v3: fixed msvcr120_app spec
From: Stephane Bacri frisou76@yahoo.fr
--- dlls/msvcr120/msvcr120.spec | 8 +++--- dlls/msvcr120/tests/msvcr120.c | 50 ++++++++++++++++++++++++++++++++++ dlls/msvcrt/math.c | 21 ++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 8 +++--- 4 files changed, 79 insertions(+), 8 deletions(-)
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 78420df3757..162465fef4a 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -830,7 +830,7 @@ @ stdcall _CxxThrowException(ptr ptr) @ cdecl -arch=i386 -norelay _EH_prolog() @ stub -arch=arm _FPE_Raise -@ stub _FCbuild +@ cdecl _FCbuild(ptr float float) @ cdecl _FindAndUnlinkFrame(ptr) @ stub -arch=win64 _GetImageBase @ stub -arch=win64 _GetThrowImageBase @@ -2076,8 +2076,8 @@ @ stub cexp @ stub cexpf @ stub cexpl -@ stub cimag -@ stub cimagf +@ cdecl cimag(int128) MSVCR120_cimag +@ cdecl cimagf(int64) MSVCR120_cimagf @ stub cimagl @ cdecl clearerr(ptr) @ cdecl clearerr_s(ptr) @@ -2105,7 +2105,7 @@ @ stub cprojf @ stub cprojl @ cdecl creal(int128) MSVCR120_creal -@ stub crealf +@ cdecl crealf(int64) MSVCR120_crealf @ stub creall @ stub csin @ stub csinf diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 2c9569f750d..4dca4b1a0bc 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -155,6 +155,12 @@ typedef struct double i; } _Dcomplex;
+typedef struct +{ + float r; + float i; +} _Fcomplex; + typedef void (*vtable_ptr)(void);
typedef struct { @@ -222,7 +228,11 @@ static void (__cdecl *p_free_locale)(_locale_t); static unsigned short (__cdecl *p_wctype)(const char*); static int (__cdecl *p_vsscanf)(const char*, const char *, va_list valist); static _Dcomplex* (__cdecl *p__Cbuild)(_Dcomplex*, double, double); +static _Fcomplex* (__cdecl *p__FCbuild)(_Fcomplex*, float, float); static double (__cdecl *p_creal)(_Dcomplex); +static float (__cdecl *p_crealf)(_Fcomplex); +static double (__cdecl *p_cimag)(_Dcomplex); +static float (__cdecl *p_cimagf)(_Fcomplex); static double (__cdecl *p_nexttoward)(double, double); static float (__cdecl *p_nexttowardf)(float, double); static double (__cdecl *p_nexttowardl)(double, double); @@ -333,6 +343,10 @@ static BOOL init(void) SET(p_vsscanf, "vsscanf"); SET(p__Cbuild, "_Cbuild"); SET(p_creal, "creal"); + SET(p_cimag, "cimag"); + SET(p__FCbuild, "_FCbuild"); + SET(p_crealf, "crealf"); + SET(p_cimagf, "cimagf"); SET(p_nexttoward, "nexttoward"); SET(p_nexttowardf, "nexttowardf"); SET(p_nexttowardl, "nexttowardl"); @@ -1303,12 +1317,47 @@ static void test__Cbuild(void) ok(c.i == 2.0, "c.i = %lf\n", c.i); d = p_creal(c); ok(d == 1.0, "creal returned %lf\n", d); + d = p_cimag(c); + ok(d == 2.0, "cimag returned %lf\n", d);
p__Cbuild(&c, 3.0, NAN); ok(c.r == 3.0, "c.r = %lf\n", c.r); ok(_isnan(c.i), "c.i = %lf\n", c.i); d = p_creal(c); ok(d == 3.0, "creal returned %lf\n", d); + + p__Cbuild(&c, NAN, 4.0); + ok(_isnan(c.r), "c.r = %lf\n", c.r); + ok(c.i == 4.0, "c.i = %lf\n", c.i); + d = p_cimag(c); + ok(d == 4.0, "cimag returned %lf\n", d); +} + +static void test__FCbuild(void) +{ + _Fcomplex c; + float d; + + memset(&c, 0, sizeof(c)); + p__FCbuild(&c, 1.0f, 2.0f); + ok(c.r == 1.0f, "c.r = %lf\n", c.r); + ok(c.i == 2.0f, "c.i = %lf\n", c.i); + d = p_crealf(c); + ok(d == 1.0f, "crealf returned %lf\n", d); + d = p_cimagf(c); + ok(d == 2.0f, "cimagf returned %lf\n", d); + + p__FCbuild(&c, 3.0f, NAN); + ok(c.r == 3.0f, "c.r = %lf\n", c.r); + ok(_isnan(c.i), "c.i = %lf\n", c.i); + d = p_crealf(c); + ok(d == 3.0f, "crealf returned %lf\n", d); + + p__FCbuild(&c, NAN, 4.0f); + ok(_isnan(c.r), "c.r = %lf\n", c.r); + ok(c.i == 4.0f, "c.i = %lf\n", c.i); + d = p_cimagf(c); + ok(d == 4.0f, "cimagf returned %lf\n", d); }
static void test_nexttoward(void) @@ -1904,6 +1953,7 @@ START_TEST(msvcr120) test__Condition_variable(); test_wctype(); test_vsscanf(); + test__FCbuild(); test__Cbuild(); test_nexttoward(); test_towctrans(); diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index be345fb7a4a..5a3f337d8e6 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -2970,4 +2970,25 @@ double CDECL MSVCR120_creal(_Dcomplex z) return z._Val[0]; }
+double CDECL MSVCR120_cimag(_Dcomplex z) +{ + return z._Val[1]; +} + +_Fcomplex* CDECL _FCbuild(_Fcomplex *ret, float r, float i) +{ + ret->_Val[0] = r; + ret->_Val[1] = i; + return ret; +} + +float CDECL MSVCR120_crealf(_Fcomplex z) +{ + return z._Val[0]; +} + +float CDECL MSVCR120_cimagf(_Fcomplex z) +{ + return z._Val[1]; +} #endif /* _MSVCR_VER>=120 */ diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index cd8f9f23898..6974637206d 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -21,7 +21,7 @@ @ stdcall _CxxThrowException(ptr ptr) @ cdecl -arch=i386 -norelay _EH_prolog() @ cdecl _Exit(long) _exit -@ stub _FCbuild +@ cdecl _FCbuild(ptr float float) @ stub _FCmulcc @ stub _FCmulcr @ cdecl _FindAndUnlinkFrame(ptr) @@ -2221,8 +2221,8 @@ @ stub cexp @ stub cexpf @ stub cexpl -@ stub cimag -@ stub cimagf +@ cdecl cimag(int128) MSVCR120_cimag +@ cdecl cimagf(int64) MSVCR120_cimagf @ stub cimagl @ cdecl clearerr(ptr) @ cdecl clearerr_s(ptr) @@ -2250,7 +2250,7 @@ @ stub cprojf @ stub cprojl @ cdecl creal(int128) MSVCR120_creal -@ stub crealf +@ cdecl crealf(int64) MSVCR120_crealf @ stub creall @ stub csin @ stub csinf
From: Stephane Bacri frisou76@yahoo.fr
--- dlls/msvcr120_app/msvcr120_app.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index c15de4d01ce..9ba22227f8b 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -825,7 +825,7 @@ @ stdcall _CxxThrowException(ptr ptr) msvcr120._CxxThrowException @ cdecl -arch=i386 -norelay _EH_prolog() msvcr120._EH_prolog @ stub -arch=arm _FPE_Raise -@ stub _FCbuild +@ cdecl _FCbuild(ptr float float) msvcr120._FCbuild @ cdecl _FindAndUnlinkFrame(ptr) msvcr120._FindAndUnlinkFrame @ stub -arch=win64 _GetImageBase @ stub -arch=win64 _GetThrowImageBase @@ -1743,8 +1743,8 @@ @ stub cexp @ stub cexpf @ stub cexpl -@ stub cimag -@ stub cimagf +@ cdecl cimag(int128) msvcr120.cimag +@ cdecl cimagf(int64) msvcr120.cimagf @ stub cimagl @ cdecl clearerr(ptr) msvcr120.clearerr @ cdecl clearerr_s(ptr) msvcr120.clearerr_s @@ -1772,7 +1772,7 @@ @ stub cprojf @ stub cprojl @ cdecl creal(int128) msvcr120.creal -@ stub crealf +@ cdecl crealf(int64) msvcr120.crealf @ stub creall @ stub csin @ stub csinf
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=151071
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w7u_adm (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w7u_el (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w1064v1809 (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w1064_tsign (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w10pro64 (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w10pro64_en_AE_u8 (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w11pro64 (32 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w1064v1809 (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w1064_2qxl (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w1064_adm (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w1064_tsign (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w10pro64 (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w10pro64_ar (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w10pro64_ja (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w10pro64_zh_CN (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000
=== w11pro64_amd (64 bit report) ===
msvcr120: msvcr120.c:1343: Test failed: c.r = 0.000000 msvcr120.c:1344: Test failed: c.i = 0.000000 msvcr120.c:1346: Test failed: crealf returned 0.000000 msvcr120.c:1348: Test failed: cimagf returned 0.000000 msvcr120.c:1351: Test failed: c.r = 0.000000 msvcr120.c:1352: Test failed: c.i = 0.000000 msvcr120.c:1354: Test failed: crealf returned 0.000000 msvcr120.c:1357: Test failed: c.r = 0.000000 msvcr120.c:1358: Test failed: c.i = 0.000000 msvcr120.c:1360: Test failed: cimagf returned 0.000000