From 83a0c2085f55bbe789f7aabf1d494c24c8d6ab37 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 1 Oct 2018 19:50:45 +0200 Subject: [PATCH] msvcr120: Added creal implementation. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- .../api-ms-win-crt-math-l1-1-0.spec | 3 ++- dlls/msvcr120/msvcr120.spec | 3 ++- dlls/msvcr120/tests/msvcr120.c | 7 +++++++ dlls/msvcr120_app/msvcr120_app.spec | 3 ++- dlls/msvcrt/math.c | 5 +++++ dlls/ucrtbase/ucrtbase.spec | 3 ++- 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec index ec85a53bf7e..e7f3c9800b1 100644 --- a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec +++ b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec @@ -202,7 +202,8 @@ @ stub cproj @ stub cprojf @ stub cprojl -@ stub creal +@ cdecl -arch=i386 creal(double double) ucrtbase.creal +@ cdecl -arch=arm,x86_64,arm64 creal(ptr) ucrtbase.creal @ stub crealf @ stub creall @ stub csin diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index f3ab39a1d3e..fe4e2bd9b52 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2103,7 +2103,8 @@ @ stub cproj @ stub cprojf @ stub cprojl -@ stub creal +@ cdecl -arch=i386 creal(double double) MSVCR120_creal +@ cdecl -arch=arm,x86_64,arm64 creal(ptr) MSVCR120_creal @ stub crealf @ stub creall @ stub csin diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 37957d57c40..79b667e42b0 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -191,6 +191,7 @@ 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 *, __ms_va_list valist); static _Dcomplex* (__cdecl *p__Cbuild)(_Dcomplex*, double, double); +static double (__cdecl *p_creal)(_Dcomplex); /* make sure we use the correct errno */ #undef errno @@ -250,6 +251,7 @@ static BOOL init(void) SET(p__clearfp, "_clearfp"); SET(p_vsscanf, "vsscanf"); SET(p__Cbuild, "_Cbuild"); + SET(p_creal, "creal"); if(sizeof(void*) == 8) { /* 64-bit initialization */ SET(p_critical_section_ctor, "??0critical_section@Concurrency@@QEAA@XZ"); @@ -946,15 +948,20 @@ static void test_vsscanf(void) static void test__Cbuild(void) { _Dcomplex c; + double d; memset(&c, 0, sizeof(c)); p__Cbuild(&c, 1.0, 2.0); ok(c.r == 1.0, "c.r = %lf\n", c.r); ok(c.i == 2.0, "c.i = %lf\n", c.i); + d = p_creal(c); + ok(d == 1.0, "creal 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); } START_TEST(msvcr120) diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 1076ddf5b77..4429a0cfc16 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1769,7 +1769,8 @@ @ stub cproj @ stub cprojf @ stub cprojl -@ stub creal +@ cdecl -arch=i386 creal(double double) msvcr120.creal +@ cdecl -arch=arm,x86_64,arm64 creal(ptr) msvcr120.creal @ stub crealf @ stub creall @ stub csin diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index b9202515afd..d4785d35085 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -3390,4 +3390,9 @@ _Dcomplex* CDECL MSVCR120__Cbuild(_Dcomplex *ret, double r, double i) return ret; } +double CDECL MSVCR120_creal(_Dcomplex z) +{ + return z.x; +} + #endif /* _MSVCR_VER>=120 */ diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 3d0de47a40e..084bea8e562 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2246,7 +2246,8 @@ @ stub cproj @ stub cprojf @ stub cprojl -@ stub creal +@ cdecl -arch=i386 creal(double double) MSVCR120_creal +@ cdecl -arch=arm,x86_64,arm64 creal(ptr) MSVCR120_creal @ stub crealf @ stub creall @ stub csin