Fix CREAL,CIMAG macros for PGI
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>
Sun, 12 Mar 2017 23:36:01 +0000 (00:36 +0100)
committerGitHub <noreply@github.com>
Sun, 12 Mar 2017 23:36:01 +0000 (00:36 +0100)
common.h

index b4acada..c9cc2f0 100644 (file)
--- a/common.h
+++ b/common.h
@@ -556,8 +556,13 @@ static void __inline blas_lock(volatile BLASULONG *address){
 #endif
 
 #if defined(C_PGI) || defined(C_SUN)
-#define CREAL(X)       (*((FLOAT *)&X + 0))
-#define CIMAG(X)       (*((FLOAT *)&X + 1))
+  #if defined(__STDC_IEC_559_COMPLEX__)
+     #define CREAL(X)   creal(X)
+     #define CIMAG(X)   cimag(X)
+  #else
+     #define CREAL(X)  (*((FLOAT *)&X + 0))
+     #define CIMAG(X)  (*((FLOAT *)&X + 1))
+  #endif
 #else
 #ifdef OPENBLAS_COMPLEX_STRUCT
 #define CREAL(Z)       ((Z).real)