summaryrefslogtreecommitdiffstats
path: root/tcl8.6/pkgs/tdbcpostgres1.1.0/generic/int2ptr_ptr2int.h
diff options
context:
space:
mode:
Diffstat (limited to 'tcl8.6/pkgs/tdbcpostgres1.1.0/generic/int2ptr_ptr2int.h')
-rw-r--r--tcl8.6/pkgs/tdbcpostgres1.1.0/generic/int2ptr_ptr2int.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/tcl8.6/pkgs/tdbcpostgres1.1.0/generic/int2ptr_ptr2int.h b/tcl8.6/pkgs/tdbcpostgres1.1.0/generic/int2ptr_ptr2int.h
new file mode 100644
index 0000000..4b0a15d
--- /dev/null
+++ b/tcl8.6/pkgs/tdbcpostgres1.1.0/generic/int2ptr_ptr2int.h
@@ -0,0 +1,24 @@
+/*
+ * Macros used to cast between pointers and integers (e.g. when storing an int
+ * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
+ * to/from pointer from/to integer of different size".
+ */
+
+#if !defined(INT2PTR) && !defined(PTR2INT)
+# if defined(HAVE_INTPTR_T) || defined(intptr_t)
+# define INT2PTR(p) ((void *)(intptr_t)(p))
+# define PTR2INT(p) ((int)(intptr_t)(p))
+# else
+# define INT2PTR(p) ((void *)(p))
+# define PTR2INT(p) ((int)(p))
+# endif
+#endif
+#if !defined(UINT2PTR) && !defined(PTR2UINT)
+# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
+# define UINT2PTR(p) ((void *)(uintptr_t)(p))
+# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
+# else
+# define UINT2PTR(p) ((void *)(p))
+# define PTR2UINT(p) ((unsigned int)(p))
+# endif
+#endif