From 24fab19cef4ddd030ffa37a85b527d1b368e5481 Mon Sep 17 00:00:00 2001 From: Stepets Date: Sun, 20 Apr 2014 13:22:43 +0400 Subject: LuaJIT auto detect --- src/tools.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools.h b/src/tools.h index 8e8bb7d..2609ce9 100644 --- a/src/tools.h +++ b/src/tools.h @@ -18,14 +18,15 @@ // For some reason, LuaJIT 64bits doesn't support lua_newstate() // If you build specifically for this situation, change value to 0 -#define PROPAGATE_ALLOCF 1 -#if PROPAGATE_ALLOCF +#if defined(LUA_LJDIR) && (defined(__x86_64__) || defined(_M_X64)) +#define PROPAGATE_ALLOCF 0 #define PROPAGATE_ALLOCF_PREP( L) void* allocUD; lua_Alloc allocF = lua_getallocf( L, &allocUD) #define PROPAGATE_ALLOCF_ALLOC() lua_newstate( allocF, allocUD) -#else // PROPAGATE_ALLOCF +#else // luaJIT x64 +#define PROPAGATE_ALLOCF 1 #define PROPAGATE_ALLOCF_PREP( L) #define PROPAGATE_ALLOCF_ALLOC() luaL_newstate() -#endif // PROPAGATE_ALLOCF +#endif // luaJIT x64 #define USE_DEBUG_SPEW 0 #if USE_DEBUG_SPEW -- cgit v1.2.3-55-g6feb From f33e4e68f5877a35e4952e1f53704464c18a53ed Mon Sep 17 00:00:00 2001 From: Stepets Date: Sun, 20 Apr 2014 13:56:34 +0400 Subject: LuaJIT auto detect FIX --- src/tools.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tools.h b/src/tools.h index 2609ce9..b868440 100644 --- a/src/tools.h +++ b/src/tools.h @@ -17,16 +17,18 @@ #endif // For some reason, LuaJIT 64bits doesn't support lua_newstate() -// If you build specifically for this situation, change value to 0 #if defined(LUA_LJDIR) && (defined(__x86_64__) || defined(_M_X64)) #define PROPAGATE_ALLOCF 0 +#else // LuaJIT x64 +#define PROPAGATE_ALLOCF 1 +#endif // LuaJIT x64 +#if PROPAGATE_ALLOCF #define PROPAGATE_ALLOCF_PREP( L) void* allocUD; lua_Alloc allocF = lua_getallocf( L, &allocUD) #define PROPAGATE_ALLOCF_ALLOC() lua_newstate( allocF, allocUD) -#else // luaJIT x64 -#define PROPAGATE_ALLOCF 1 +#else // PROPAGATE_ALLOCF #define PROPAGATE_ALLOCF_PREP( L) #define PROPAGATE_ALLOCF_ALLOC() luaL_newstate() -#endif // luaJIT x64 +#endif // PROPAGATE_ALLOCF #define USE_DEBUG_SPEW 0 #if USE_DEBUG_SPEW -- cgit v1.2.3-55-g6feb