From 45f3797a5b3ac126fb8ada48492fbca4be39912b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 21 Jun 2013 14:42:28 -0300 Subject: [PATCH] 'long' may have more than 32 bits in some machines; use 'int' for small lua_Integer unless necessary to use 'long' --- luaconf.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/luaconf.h b/luaconf.h index a7a16f6a..fe9fcd25 100644 --- a/luaconf.h +++ b/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.182 2013/06/13 19:35:08 roberto Exp roberto $ +** $Id: luaconf.h,v 1.183 2013/06/20 15:02:49 roberto Exp roberto $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -494,14 +494,21 @@ #if LUA_SMALL_INT /* { */ -#define LUA_INTEGER long +#if LUAI_BITSINT >= 32 +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#else + +#define LUA_INTEGER long #define LUA_INTEGER_FRMLEN "l" +#endif + #else /* }{ */ -#define LUA_INTEGER long long - +#define LUA_INTEGER long long #define LUA_INTEGER_FRMLEN "ll" #endif /* } */ @@ -510,7 +517,7 @@ #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" #define lua_integer2str(s,n) sprintf((s), LUA_INTEGER_FMT, (n)) -#define LUA_UNSIGNED unsigned LUA_INTEGER +#define LUA_UNSIGNED unsigned LUA_INTEGER /* }================================================================== */