ensure operation order is preserved
@@ -143,13 +143,13 @@ cdef str _convert_cuComplex_to_Thrust(str source):
#define make_cuFloatComplex(A, B) complex<float>(A, B)
#define make_cuComplex(A, B) complex<float>(A, B)
#define cuConjf conj
- #define cuCaddf(A, B) A + B
- #define cuCsubf(A, B) A - B
- #define cuCmulf(A, B) A * B
- #define cuCdivf(A, B) A / B
+ #define cuCaddf(A, B) (A + B)
+ #define cuCsubf(A, B) (A - B)
+ #define cuCmulf(A, B) (A * B)
+ #define cuCdivf(A, B) (A / B)
#define cuCabsf abs
#define cuComplexDoubleToFloat complex<float>
- #define cuCfmaf(A, B, C) A * B + C
+ #define cuCfmaf(A, B, C) (A * B + C)
/* ------------------- double complex ------------------- */
#define cuDoubleComplex complex<double>
@@ -157,13 +157,13 @@ cdef str _convert_cuComplex_to_Thrust(str source):
#define cuCimag imag
#define make_cuDoubleComplex(A, B) complex<double>(A, B)
#define cuConj conj
- #define cuCadd(A, B) A + B
- #define cuCsub(A, B) A - B
- #define cuCmul(A, B) A * B
- #define cuCdiv(A, B) A / B
+ #define cuCadd(A, B) (A + B)
+ #define cuCsub(A, B) (A - B)
+ #define cuCmul(A, B) (A * B)
+ #define cuCdiv(A, B) (A / B)
#define cuCabs abs
#define cuComplexFloatToDouble complex<double>
- #define cuCfma(A, B, C) A * B + C
+ #define cuCfma(A, B, C) (A * B + C)
'''
source = macro + source
return source
