Created
November 5, 2016 11:57
-
-
Save catwell/9c2cf1a4f86c68d9a53deeb989c37b62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/lmathlib.c b/src/lmathlib.c | |
index 4f2ec60..d87536d 100644 | |
--- a/src/lmathlib.c | |
+++ b/src/lmathlib.c | |
@@ -183,7 +183,7 @@ static int math_log (lua_State *L) { | |
res = l_mathop(log)(x); | |
else { | |
lua_Number base = luaL_checknumber(L, 2); | |
-#if !defined(LUA_USE_C89) | |
+#if defined(LUA_USE_LOG2) | |
if (base == 2.0) res = l_mathop(log2)(x); else | |
#endif | |
if (base == 10.0) res = l_mathop(log10)(x); | |
diff --git a/src/luaconf.h b/src/luaconf.h | |
index 7cfa4fa..581fcdb 100644 | |
--- a/src/luaconf.h | |
+++ b/src/luaconf.h | |
@@ -51,6 +51,9 @@ | |
#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ | |
#endif | |
+#if defined(__ANDROID__) | |
+#define LUA_USE_ANDROID | |
+#endif | |
#if defined(LUA_USE_WINDOWS) | |
#define LUA_DL_DLL /* enable support for DLL */ | |
@@ -77,7 +80,7 @@ | |
** C89 ('long' and 'double'); Windows always has '__int64', so it does | |
** not need to use this case. | |
*/ | |
-#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) | |
+#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) && !defined(LUA_USE_ANDROID) | |
#define LUA_C89_NUMBERS | |
#endif | |
@@ -589,7 +592,7 @@ | |
/* | |
-@@ lua_number2strx converts a float to an hexadecimal numeric string. | |
+@@ lua_number2strx converts a float to an hexadecimal numeric string. | |
** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. | |
** Otherwise, you can leave 'lua_number2strx' undefined and Lua will | |
** provide its own implementation. | |
@@ -636,6 +639,11 @@ | |
** Change that if you do not want to use C locales. (Code using this | |
** macro must include header 'locale.h'.) | |
*/ | |
+ | |
+#if defined(LUA_USE_ANDROID) && !defined(lua_getlocaledecpoint) | |
+#define lua_getlocaledecpoint() ('.') | |
+#endif | |
+ | |
#if !defined(lua_getlocaledecpoint) | |
#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) | |
#endif | |
@@ -743,6 +751,10 @@ | |
*/ | |
+/* Android does not support log2. */ | |
+#if !defined(LUA_USE_C89) && !defined(LUA_USE_ANDROID) | |
+#define LUA_USE_LOG2 | |
+#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment