summaryrefslogtreecommitdiff
path: root/kernels
diff options
context:
space:
mode:
authorLuo Xionghu <xionghu.luo@intel.com>2014-11-05 11:10:40 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-11-05 19:21:12 +0800
commit8f850096d4631870e8ac84d8fe15e2ad41a35c84 (patch)
treea5ecb0061edb4d2704864c8b2684afa83ef49576 /kernels
parent3614e80284ca36134e8dc74eeeae0ed2fe3d15e1 (diff)
fix bswap kernel function type issue.
use MACRO to define the corresponding function. Signed-off-by: Luo Xionghu <xionghu.luo@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'kernels')
-rw-r--r--kernels/compiler_bswap.cl15
1 files changed, 10 insertions, 5 deletions
diff --git a/kernels/compiler_bswap.cl b/kernels/compiler_bswap.cl
index d6ed91a9..9ef0e6b7 100644
--- a/kernels/compiler_bswap.cl
+++ b/kernels/compiler_bswap.cl
@@ -1,7 +1,12 @@
-kernel void compiler_bswap_short(global short* src, global short* dst){
- dst[get_global_id(0)]= __builtin_bswap16(src[get_global_id(0)]);
+#define TEST_TYPE(TYPE, LENGTH) \
+kernel void compiler_bswap_##TYPE(global TYPE * src, global TYPE * dst){ \
+ dst[get_global_id(0)]= __builtin_bswap##LENGTH(src[get_global_id(0)]); \
}
-kernel void compiler_bswap_int(global int* src, global int* dst){
- dst[get_global_id(0)]= __builtin_bswap32(src[get_global_id(0)]);
-}
+
+TEST_TYPE(short, 16)
+TEST_TYPE(ushort, 16)
+TEST_TYPE(int, 32)
+TEST_TYPE(uint, 32)
+
+#undef TEST_TYPE