From 8b925cd2adb8074e11645118c17dbd68649c5800 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 21 Apr 2011 00:56:50 +0200 Subject: [PATCH] LUA: Change IntPoint() to work warning-less (hopefully) everywhere --- lua/README.eos | 4 +++- lua/llimits.h | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lua/README.eos b/lua/README.eos index 86a4fe2947..94d81648a8 100644 --- a/lua/README.eos +++ b/lua/README.eos @@ -5,5 +5,7 @@ Changes: ======== - Silenced a compiler warning (unused value) in liolib.c -- Increase the size of lu_hash, so it won't make any problem on 64bit +- Increased the size of lu_hash, so it won't make any problem on 64bit systems +- Changed the definition of IntPoint() to work warning-less on systems + where sizeof(void *) < sizeof(lu_hash) diff --git a/lua/llimits.h b/lua/llimits.h index 820770062d..972ca165a6 100644 --- a/lua/llimits.h +++ b/lua/llimits.h @@ -7,6 +7,20 @@ #ifndef llimits_h #define llimits_h +#ifdef HAVE_CONFIG_H + #include "config.h" + #undef VERSION +#endif + +#ifdef HAVE_STDINT_H + #include +#endif +#ifdef HAVE_INTTYPES_H + #include +#endif +#ifdef HAVE_SYS_TYPES_H + #include +#endif #include #include @@ -69,7 +83,7 @@ typedef unsigned char lu_byte; ** this is for hashing only; there is no problem if the integer ** cannot hold the whole pointer value */ -#define IntPoint(p) ((lu_hash)(p)) +#define IntPoint(p) ((lu_hash)(uintptr_t)(p))