static cl_int printPBI_flagt(cl_program program , cl_device_id device, cl_program_build_info buildInfo) { T value; cl_int err; err = clGetProgramBuildInfo( program, device, buildInfo, sizeof(T), &value, NULL ); if ( err != CL_SUCCESS ) { printf("Failed to get build info."); return err; } #define BFLAG(F) if ( value == F ) printf(#F) if (buildInfo == CL_PROGRAM_BUILD_STATUS ) { BFLAG(CL_BUILD_NONE); BFLAG(CL_BUILD_ERROR); BFLAG(CL_BUILD_SUCCESS); BFLAG(CL_BUILD_IN_PROGRESS); } #ifdef CL_VERSION_1_2 else if (buildInfo == CL_PROGRAM_BINARY_TYPE ) { BFLAG(CL_PROGRAM_BINARY_TYPE_NONE); BFLAG(CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT); BFLAG(CL_PROGRAM_BINARY_TYPE_LIBRARY); BFLAG(CL_PROGRAM_BINARY_TYPE_EXECUTABLE); } #endif else { printf("Wrong handler."); return CL_INVALID_VALUE; } #undef BFLAG return CL_SUCCESS; }
* Flags for type of function: unlike the above, these must * be individually bit-testable. */ enum { TF_NOCONV = 1, /* don't convert to float */ TF_INT1 = 2, /* first argument is integer */ TF_INT2 = 4, /* second argument is integer */ TF_NOASS = 8 /* don't assign result as double */ }; #define TFLAG(x) ((x) << 16) static struct mathfunc mftab[] = { NUMMATHFUNC("abs", math_func, 1, 1, MF_ABS | BFLAG(BF_FRAC) | TFLAG(TF_NOCONV|TF_NOASS)), NUMMATHFUNC("acos", math_func, 1, 1, MF_ACOS | BFLAG(BF_FRAC)), NUMMATHFUNC("acosh", math_func, 1, 1, MF_ACOSH | BFLAG(BF_GE1)), NUMMATHFUNC("asin", math_func, 1, 1, MF_ASIN | BFLAG(BF_FRAC)), NUMMATHFUNC("asinh", math_func, 1, 1, MF_ASINH), NUMMATHFUNC("atan", math_func, 1, 2, MF_ATAN), NUMMATHFUNC("atanh", math_func, 1, 1, MF_ATANH | BFLAG(BF_FRACO)), NUMMATHFUNC("cbrt", math_func, 1, 1, MF_CBRT), NUMMATHFUNC("ceil", math_func, 1, 1, MF_CEIL), NUMMATHFUNC("copysign", math_func, 2, 2, MF_COPYSIGN), NUMMATHFUNC("cos", math_func, 1, 1, MF_COS), NUMMATHFUNC("cosh", math_func, 1, 1, MF_COSH), NUMMATHFUNC("erf", math_func, 1, 1, MF_ERF), NUMMATHFUNC("erfc", math_func, 1, 1, MF_ERFC), NUMMATHFUNC("exp", math_func, 1, 1, MF_EXP),