summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorHomer Hsing <homer.xing@intel.com>2013-01-04 09:22:28 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-04-10 14:51:30 +0800
commitc29a26fbdc72a6a6eb020ee3b59b6c8042698f53 (patch)
tree5260708e847bb6ac5ad1e9efd19ad6efe62e2ab2 /backend
parentbefa9a6c075801228a813881c799e6621ee40ba6 (diff)
support OpenCL 1.1 integer built-in macros
Diffstat (limited to 'backend')
-rw-r--r--backend/src/ocl_stdlib.h18
-rw-r--r--backend/src/ocl_stdlib_str.cpp18
2 files changed, 36 insertions, 0 deletions
diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h
index 34ffcf97..b6d8a39c 100644
--- a/backend/src/ocl_stdlib.h
+++ b/backend/src/ocl_stdlib.h
@@ -106,6 +106,24 @@ typedef size_t event_t;
#define M_SQRT2_F 1.4142135623730951F
#define M_SQRT1_2_F 0.7071067811865476F
/////////////////////////////////////////////////////////////////////////////
+// OpenCL integer built-in macros
+/////////////////////////////////////////////////////////////////////////////
+#define CHAR_BIT 8
+#define CHAR_MAX SCHAR_MAX
+#define CHAR_MIN SCHAR_MIN
+#define INT_MAX 2147483647
+#define INT_MIN (-2147483647 - 1)
+#define LONG_MAX 0x7fffffffffffffffL
+#define LONG_MIN (-0x7fffffffffffffffL - 1)
+#define SCHAR_MAX 127
+#define SCHAR_MIN (-127 - 1)
+#define SHRT_MAX 32767
+#define SHRT_MIN (-32767 - 1)
+#define UCHAR_MAX 255
+#define USHRT_MAX 65535
+#define UINT_MAX 0xffffffff
+#define ULONG_MAX 0xffffffffffffffffUL
+/////////////////////////////////////////////////////////////////////////////
// OpenCL relational built-in functions
/////////////////////////////////////////////////////////////////////////////
#define DEF DECL(int, float); \
diff --git a/backend/src/ocl_stdlib_str.cpp b/backend/src/ocl_stdlib_str.cpp
index 98bda56d..2b900def 100644
--- a/backend/src/ocl_stdlib_str.cpp
+++ b/backend/src/ocl_stdlib_str.cpp
@@ -110,6 +110,24 @@ std::string ocl_stdlib_str =
"#define M_SQRT2_F 1.4142135623730951F\n"
"#define M_SQRT1_2_F 0.7071067811865476F\n"
"/////////////////////////////////////////////////////////////////////////////\n"
+"// OpenCL integer built-in macros\n"
+"/////////////////////////////////////////////////////////////////////////////\n"
+"#define CHAR_BIT 8\n"
+"#define CHAR_MAX SCHAR_MAX\n"
+"#define CHAR_MIN SCHAR_MIN\n"
+"#define INT_MAX 2147483647\n"
+"#define INT_MIN (-2147483647 - 1)\n"
+"#define LONG_MAX 0x7fffffffffffffffL\n"
+"#define LONG_MIN (-0x7fffffffffffffffL - 1)\n"
+"#define SCHAR_MAX 127\n"
+"#define SCHAR_MIN (-127 - 1)\n"
+"#define SHRT_MAX 32767\n"
+"#define SHRT_MIN (-32767 - 1)\n"
+"#define UCHAR_MAX 255\n"
+"#define USHRT_MAX 65535\n"
+"#define UINT_MAX 0xffffffff\n"
+"#define ULONG_MAX 0xffffffffffffffffUL\n"
+"/////////////////////////////////////////////////////////////////////////////\n"
"// OpenCL relational built-in functions\n"
"/////////////////////////////////////////////////////////////////////////////\n"
"#define DEF DECL(int, float); \\\n"