From 9852dec8eb4827c206cd4b9b8c8709c340fe6d42 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 9 Aug 2002 19:47:06 +0000 Subject: [PATCH] Attempt to fix pthread-to-ui64 cast issue. --- platform/unix.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/unix.c b/platform/unix.c index ab84395d..48017b79 100644 --- a/platform/unix.c +++ b/platform/unix.c @@ -290,7 +290,20 @@ void __PHYSFS_platformReleaseMutex(void *mutex) {} #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) {