Skip to content

Commit

Permalink
Do not use C99 compound literals (enables compilation on g++ 4.2.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dag Sverre Seljebotn committed May 20, 2009
1 parent a18effd commit 1b8bb1b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Cython/Compiler/PyrexTypes.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -830,8 +830,10 @@ def binary_op(self, op):
#if __PYX_USE_C99_COMPLEX #if __PYX_USE_C99_COMPLEX
typedef %(real_type)s _Complex %(type_name)s; typedef %(real_type)s _Complex %(type_name)s;
#define %(type_name)s_from_parts(x, y) ((x) + (y)*(%(type)s)_Complex_I) static INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) {
return x + y*(%(type)s)_Complex_I;
}
#define %(type_name)s_is_zero(a) ((a) == 0) #define %(type_name)s_is_zero(a) ((a) == 0)
#define %(type_name)s_eq(a, b) ((a) == (b)) #define %(type_name)s_eq(a, b) ((a) == (b))
#define %(type_name)s_add(a, b) ((a)+(b)) #define %(type_name)s_add(a, b) ((a)+(b))
Expand All @@ -843,8 +845,10 @@ def binary_op(self, op):
#else #else
typedef struct { %(real_type)s real, imag; } %(type_name)s; typedef struct { %(real_type)s real, imag; } %(type_name)s;
#define %(type_name)s_from_parts(x, y) ((%(type_name)s){(%(real_type)s)x, (%(real_type)s)y}) static INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) {
%(type)s c; c.real = x; c.imag = y; return c;
}
static INLINE int %(type_name)s_is_zero(%(type)s a) { static INLINE int %(type_name)s_is_zero(%(type)s a) {
return (a.real == 0) & (a.imag == 0); return (a.real == 0) & (a.imag == 0);
} }
Expand Down

0 comments on commit 1b8bb1b

Please sign in to comment.