diff options
author | CNugteren <web@cedricnugteren.nl> | 2015-07-02 07:11:27 +0200 |
---|---|---|
committer | CNugteren <web@cedricnugteren.nl> | 2015-07-02 07:11:27 +0200 |
commit | d879eb3abf17253fc12bcf9ee090632d9cb28a22 (patch) | |
tree | b00d276456134f9aaff860c86df2bd3423f705dd | |
parent | e3dd35f91baf9f0c4cf35d58d3dcbdb4ce8fb3b7 (diff) |
Added a set-to-one function for kernels
-rw-r--r-- | src/kernels/common.opencl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kernels/common.opencl b/src/kernels/common.opencl index 818c725f..19af0056 100644 --- a/src/kernels/common.opencl +++ b/src/kernels/common.opencl @@ -39,6 +39,7 @@ R"( typedef float8 real8; typedef float16 real16; #define ZERO 0.0f + #define ONE 1.0f // Double-precision #elif PRECISION == 64 @@ -48,6 +49,7 @@ R"( typedef double8 real8; typedef double16 real16; #define ZERO 0.0 + #define ONE 1.0 // Complex single-precision #elif PRECISION == 3232 @@ -61,6 +63,7 @@ R"( real s8; real s9; real sA; real sB; real sC; real sD; real sE; real sF;} real16; #define ZERO 0.0f + #define ONE 1.0f // Complex Double-precision #elif PRECISION == 6464 @@ -74,6 +77,7 @@ R"( real s8; real s9; real sA; real sB; real sC; real sD; real sE; real sF;} real16; #define ZERO 0.0 + #define ONE 1.0 #endif // ================================================================================================= @@ -88,6 +92,13 @@ R"( #define SetToZero(a) a = ZERO #endif +// Sets a variable to one +#if PRECISION == 3232 || PRECISION == 6464 + #define SetToOne(a) a.x = ONE; a.y = ZERO +#else + #define SetToOne(a) a = ONE +#endif + // Multiply two complex variables (used in the define below) #if PRECISION == 3232 || PRECISION == 6464 #define MulReal(a, b) a.x*b.x - a.y*b.y |