Attempt to fix pthread-to-ui64 cast issue.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 09 Aug 2002 19:47:06 +0000
changeset 452 89578e99ba6e
parent 451 4579e942ef95
child 453 108de3bb1b6b
Attempt to fix pthread-to-ui64 cast issue.
platform/unix.c
--- a/platform/unix.c	Fri Aug 09 19:46:08 2002 +0000
+++ b/platform/unix.c	Fri Aug 09 19:47:06 2002 +0000
@@ -290,7 +290,20 @@
 
 #else
 
-#define PHTREAD_TO_UI64(thr) ((PHYSFS_uint64) (thr))
+/* Just in case; this is a panic value. */
+#if ((!defined SIZEOF_INT) || (SIZEOF_INT <= 0))
+#  define SIZEOF_INT 4
+#endif
+
+#if (SIZEOF_INT == 4)
+#  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint32) (thr)) )
+#elif (SIZEOF_INT == 2)
+#  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint16) (thr)) )
+#elif (SIZEOF_INT == 1)
+#  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint8) (thr)) )
+#else
+#  define PHTREAD_TO_UI64(thr) ((PHYSFS_uint64) (thr))
+#endif
 
 PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
 {