summaryrefslogtreecommitdiff
path: root/libs/liblua/src/lmathlib.c
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-06-13 14:18:51 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-06-13 14:18:51 +0000
commit8cf571c5ea48be2d281d2c83ed0f2dba6f2c32f4 (patch)
tree0345c47dc55eee01884f535fb26e0a2d44732213 /libs/liblua/src/lmathlib.c
parent4386b8b61c08045c5d416b546517e1c71c7dcae6 (diff)
lublua:
- updated to 5.3.3 - renamed to lua53.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@16965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'libs/liblua/src/lmathlib.c')
-rw-r--r--libs/liblua/src/lmathlib.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/liblua/src/lmathlib.c b/libs/liblua/src/lmathlib.c
index 002c508bc4..94815f129f 100644
--- a/libs/liblua/src/lmathlib.c
+++ b/libs/liblua/src/lmathlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lmathlib.c,v 1.114 2014/12/27 20:32:26 roberto Exp $
+** $Id: lmathlib.c,v 1.117 2015/10/02 15:39:23 roberto Exp $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@@ -39,7 +39,7 @@
static int math_abs (lua_State *L) {
if (lua_isinteger(L, 1)) {
lua_Integer n = lua_tointeger(L, 1);
- if (n < 0) n = (lua_Integer)(0u - n);
+ if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n);
lua_pushinteger(L, n);
}
else
@@ -183,6 +183,9 @@ 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 (base == 2.0) res = l_mathop(log2)(x); else
+#endif
if (base == 10.0) res = l_mathop(log10)(x);
else res = l_mathop(log)(x)/l_mathop(log)(base);
}
@@ -270,7 +273,7 @@ static int math_random (lua_State *L) {
static int math_randomseed (lua_State *L) {
l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1));
- (void)rand(); /* discard first value to avoid undesirable correlations */
+ (void)l_rand(); /* discard first value to avoid undesirable correlations */
return 0;
}