comparison dw.h @ 1102:cfe7d2b6bc16

Added DW_INT_TO_POINTER/DW_UINT_TO_POINTER/DW_POINTER_TO_INT/DW_POINTER_TO_UINT macros. These are used to cast between pointer and integers without generate warnings on 64bit systems. Converted Mac source and dwtest source to use them. Not sure if limits.h is available on all target platforms, will commit fixes as necessary.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 03:09:41 +0000
parents 34f1d6f5f1c3
children bf932c9316ff
comparison
equal deleted inserted replaced
1101:d7eafaa054ab 1102:cfe7d2b6bc16
1401 #define DW_HTML_STOP 5 1401 #define DW_HTML_STOP 5
1402 #define DW_HTML_PRINT 6 1402 #define DW_HTML_PRINT 6
1403 1403
1404 /* Macro for casting resource IDs to HICN */ 1404 /* Macro for casting resource IDs to HICN */
1405 #define DW_RESOURCE(a) (a < 65536 ? (HICN)a : (HICN)0) 1405 #define DW_RESOURCE(a) (a < 65536 ? (HICN)a : (HICN)0)
1406
1407 #include <limits.h>
1408 /* Macros for converting from INT/UINT to and from POINTER without compiler warnings */
1409 #if LONG_MAX > INT_MAX
1410 #define DW_INT_TO_POINTER(a) ((void *)(long)a)
1411 #define DW_POINTER_TO_INT(a) ((int)(long)a)
1412 #define DW_UINT_TO_POINTER(a) ((void *)(unsigned long)a)
1413 #define DW_POINTER_TO_UINT(a) ((unsigned int)(unsigned long)a)
1414 #else
1415 #define DW_INT_TO_POINTER(a) ((void *)a)
1416 #define DW_POINTER_TO_INT(a) ((int)a)
1417 #define DW_UINT_TO_POINTER(a) ((void *)a)
1418 #define DW_POINTER_TO_UINT(a) ((unsigned int)a)
1419 #endif
1406 1420
1407 #ifndef API 1421 #ifndef API
1408 #define API 1422 #define API
1409 #endif 1423 #endif
1410 1424