Changeset 1557a1e in sasmodels
- Timestamp:
- Jul 27, 2016 6:45:08 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- ee5d14d
- Parents:
- 1596de3
- Location:
- sasmodels
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_header.c
rb966a96 r1557a1e 7 7 // If opencl is not available, then we are compiling a C function 8 8 // Note: if using a C++ compiler, then define kernel as extern "C" 9 #ifndef USE_OPENCL 9 #ifdef USE_OPENCL 10 typedef int int32_t; 11 # if defined(USE_SINCOS) 12 # define SINCOS(angle,svar,cvar) svar=sincos(angle,&cvar) 13 # else 14 # define SINCOS(angle,svar,cvar) do {const double _t_=angle; svar=sin(_t_);cvar=cos(_t_);} while (0) 15 # endif 16 // OpenCL only has type generic math 17 #define erff erf 18 #define erfcf erfc 19 #else // !USE_OPENCL 10 20 // Use SAS_DOUBLE to force the use of double even for float kernels 11 21 # define SAS_DOUBLE dou ## ble … … 26 36 #define NAN (std::numeric_limits<double>::quiet_NaN()) // non-signalling NaN 27 37 #define INFINITY (std::numeric_limits<double>::infinity()) 38 #define NEED_ERF 28 39 #define NEED_EXPM1 29 40 #define NEED_TGAMMA … … 33 44 #endif 34 45 inline void SINCOS(double angle, double &svar, double &cvar) { svar=sin(angle); cvar=cos(angle); } 35 # else 46 # else // !__cplusplus 36 47 #include <inttypes.h> // C99 guarantees that int32_t types is here 37 48 #include <stdio.h> … … 47 58 inline SAS_DOUBLE fmin(SAS_DOUBLE x, SAS_DOUBLE y) { return x>y ? y : x; } 48 59 inline SAS_DOUBLE fmax(SAS_DOUBLE x, SAS_DOUBLE y) { return x<y ? y : x; } 60 #define NEED_ERF 49 61 #define NEED_EXPM1 50 62 #define NEED_TGAMMA … … 55 67 #define kernel 56 68 #define SINCOS(angle,svar,cvar) do {const double _t_=angle; svar=sin(_t_);cvar=cos(_t_);} while (0) 57 # endif 69 # endif // !__cplusplus 58 70 # define global 59 71 # define local … … 63 75 # define powr(a,b) pow(a,b) 64 76 # define pown(a,b) pow(a,b) 65 #else 66 typedef int int32_t; 67 # if defined(USE_SINCOS) 68 # define SINCOS(angle,svar,cvar) svar=sincos(angle,&cvar) 69 # else 70 # define SINCOS(angle,svar,cvar) do {const double _t_=angle; svar=sin(_t_);cvar=cos(_t_);} while (0) 71 # endif 72 #endif 77 #endif // !USE_OPENCL 73 78 74 79 #if defined(NEED_EXPM1)
Note: See TracChangeset
for help on using the changeset viewer.