diff dw.h @ 2132:42f8ad7a89e8

Added DW_POINTER_TO_(U)LONGLONG and DW_(U)LONGLONG_TO_POINTER macros. This allows casting with intermediate (u)intptr_t cast to avoid compiler warnings on different systems. Use these macros where necessary in the code. Might need to check the compiler supports LONG LONG... since some compilers we support might not, like old versions of VisualAge C and Watcom.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 04 Jul 2020 17:51:46 +0000
parents 663467f6eee4
children d9720d48d61e
line wrap: on
line diff
--- a/dw.h	Tue Jun 30 20:10:23 2020 +0000
+++ b/dw.h	Sat Jul 04 17:51:46 2020 +0000
@@ -1512,6 +1512,10 @@
 #define DW_POINTER_TO_INT(a) ((int)(intptr_t)a)
 #define DW_UINT_TO_POINTER(a) ((void *)(uintptr_t)a)
 #define DW_POINTER_TO_UINT(a) ((unsigned int)(uintptr_t)a)
+#define DW_LONGLONG_TO_POINTER(a) ((void *)(intptr_t)a)
+#define DW_POINTER_TO_LONGLONG(a) ((long long)(intptr_t)a)
+#define DW_ULONGLONG_TO_POINTER(a) ((void *)(uintptr_t)a)
+#define DW_POINTER_TO_ULONGLONG(a) ((unsigned long long)(uintptr_t)a)
 #elif ULONG_MAX > UINT_MAX
 /* If no intptr_t... ULONG is often bigger than UINT */
 #define DW_INT_TO_POINTER(a) ((void *)(long)a)
@@ -1525,6 +1529,12 @@
 #define DW_UINT_TO_POINTER(a) ((void *)a)
 #define DW_POINTER_TO_UINT(a) ((unsigned int)a)
 #endif
+#ifndef DW_LONGLONG_TO_POINTER
+#define DW_LONGLONG_TO_POINTER(a) ((void *)a)
+#define DW_POINTER_TO_LONGLONG(a) ((long long)a)
+#define DW_ULONGLONG_TO_POINTER(a) ((void *)a)
+#define DW_POINTER_TO_ULONGLONG(a) ((unsigned long long)a)
+#endif
 #define DW_POINTER(a) ((void *)a)
 
 #ifndef DW_FCF_COMPOSITED