[Libclc-dev] [PATCH 1/1] Add intptr types

Jan Vesely jan.vesely at rutgers.edu
Thu Jun 12 08:26:56 PDT 2014


Based on clang's stdint.h

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---

Fixes scalar-data-types piglit.
The __intn_t macros should be reusable if intXY_t types are added later[0]

regards,
Jan

[0] https://blog.ajguillon.com/2013/09/16/opencl-1-3-my-proposal-for-a-final-1-x-release/

 generic/include/clc/clctypes.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/generic/include/clc/clctypes.h b/generic/include/clc/clctypes.h
index ca729f7..ca1372d 100644
--- a/generic/include/clc/clctypes.h
+++ b/generic/include/clc/clctypes.h
@@ -7,6 +7,18 @@ typedef unsigned short ushort;
 typedef unsigned int uint;
 typedef unsigned long ulong;
 
+#define __stdint_join3(a,b,c) a ## b ## c
+
+#define  __intn_t(n) __stdint_join3(__INT, n, _TYPE__)
+#define __uintn_t(n) __stdint_join3(unsigned __INT, n, _TYPE__)
+
+typedef  __intn_t(__INTPTR_WIDTH__)  intptr_t;
+typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
+
+#undef __uintn_t
+#undef __intn_t
+#undef __stdint_join3
+
 /* 6.1.2 Built-in Vector Data Types */
 
 typedef __attribute__((ext_vector_type(2))) char char2;
-- 
1.9.3





More information about the Libclc-dev mailing list