diff options
author | RobberPhex <robberphex@gmail.com> | 2014-10-18 10:11:06 +0800 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-10-21 22:08:29 +0200 |
commit | a4e68f411e4ec390b9250d9a8c24a8849a95ba9a (patch) | |
tree | e3024c299005e97da702c5c509d84b4e6d9dee23 | |
parent | 0ddb8e35ea464da08ca3327482d96c2ec4640583 (diff) | |
download | numpy-a4e68f411e4ec390b9250d9a8c24a8849a95ba9a.tar.gz |
BUG: fix build error with MSVC 2013 caused by C99 complex support
closes gh-4896
-rw-r--r-- | numpy/core/src/npymath/npy_math_complex.c.src | 12 | ||||
-rw-r--r-- | numpy/core/src/npymath/npy_math_private.h | 24 |
2 files changed, 30 insertions, 6 deletions
diff --git a/numpy/core/src/npymath/npy_math_complex.c.src b/numpy/core/src/npymath/npy_math_complex.c.src index 920f107b8..9cbfd32ae 100644 --- a/numpy/core/src/npymath/npy_math_complex.c.src +++ b/numpy/core/src/npymath/npy_math_complex.c.src @@ -247,7 +247,8 @@ #ifdef HAVE_@KIND@@C@ @type@ npy_@kind@@c@(@ctype@ z) { - __@ctype@_to_c99_cast z1 = {z}; + __@ctype@_to_c99_cast z1; + z1.npy_z = z; return @kind@@c@(z1.c99_z); } #endif @@ -260,8 +261,9 @@ #ifdef HAVE_@KIND@@C@ @ctype@ npy_@kind@@c@(@ctype@ z) { - __@ctype@_to_c99_cast z1 = {z}; + __@ctype@_to_c99_cast z1; __@ctype@_to_c99_cast ret; + z1.npy_z = z; ret.c99_z = @kind@@c@(z1.c99_z); return ret.npy_z; } @@ -275,9 +277,11 @@ #ifdef HAVE_@KIND@@C@ @ctype@ npy_@kind@@c@(@ctype@ x, @ctype@ y) { - __@ctype@_to_c99_cast xcast = {x}; - __@ctype@_to_c99_cast ycast = {y}; + __@ctype@_to_c99_cast xcast; + __@ctype@_to_c99_cast ycast; __@ctype@_to_c99_cast ret; + xcast.npy_z = x; + ycast.npy_z = y; ret.c99_z = @kind@@c@(xcast.c99_z, ycast.c99_z); return ret.npy_z; } diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/npy_math_private.h index b3b1690be..284d203bf 100644 --- a/numpy/core/src/npymath/npy_math_private.h +++ b/numpy/core/src/npymath/npy_math_private.h @@ -485,6 +485,24 @@ do { \ * support is available */ #ifdef NPY_USE_C99_COMPLEX + +/* Microsoft C defines _MSC_VER */ +#ifdef _MSC_VER +typedef union { + npy_cdouble npy_z; + _Dcomplex c99_z; +} __npy_cdouble_to_c99_cast; + +typedef union { + npy_cfloat npy_z; + _Fcomplex c99_z; +} __npy_cfloat_to_c99_cast; + +typedef union { + npy_clongdouble npy_z; + _Lcomplex c99_z; +} __npy_clongdouble_to_c99_cast; +#else /* !_MSC_VER */ typedef union { npy_cdouble npy_z; complex double c99_z; @@ -499,7 +517,9 @@ typedef union { npy_clongdouble npy_z; complex long double c99_z; } __npy_clongdouble_to_c99_cast; -#else +#endif /* !_MSC_VER */ + +#else /* !NPY_USE_C99_COMPLEX */ typedef union { npy_cdouble npy_z; npy_cdouble c99_z; @@ -514,6 +534,6 @@ typedef union { npy_clongdouble npy_z; npy_clongdouble c99_z; } __npy_clongdouble_to_c99_cast; -#endif +#endif /* !NPY_USE_C99_COMPLEX */ #endif /* !_NPY_MATH_PRIVATE_H_ */ |