Skip to content

Commit

Permalink
msvcr120: Added creal implementation.
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Caban <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>
  • Loading branch information
PiotrCW authored and julliard committed Oct 2, 2018
1 parent 84f5d8a commit 83a0c20
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion dlls/msvcr120/msvcr120.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions dlls/msvcr120/tests/msvcr120.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion dlls/msvcr120_app/msvcr120_app.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions dlls/msvcrt/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
3 changes: 2 additions & 1 deletion dlls/ucrtbase/ucrtbase.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 83a0c20

Please sign in to comment.