aboutsummaryrefslogtreecommitdiff
path: root/lmathlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-10-02 12:39:23 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-10-02 12:39:23 -0300
commitdc4232379d79bc4ff5ad16bebf41793bb7ba6deb (patch)
tree2abb8d71a297451f59946ced865f1204a363e768 /lmathlib.c
parent10fffcd80abb2830935a5aa6b1bd1da9b1a77d97 (diff)
downloadlua-dc4232379d79bc4ff5ad16bebf41793bb7ba6deb.tar.gz
lua-dc4232379d79bc4ff5ad16bebf41793bb7ba6deb.tar.bz2
lua-dc4232379d79bc4ff5ad16bebf41793bb7ba6deb.zip
detail (ensure subtraction is done unsigned)
Diffstat (limited to 'lmathlib.c')
-rw-r--r--lmathlib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lmathlib.c b/lmathlib.c
index 4cfe33e8..8c9627c2 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.115 2015/03/12 14:04:04 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.116 2015/06/26 19:30:32 roberto Exp $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -39,7 +39,7 @@
39static int math_abs (lua_State *L) { 39static int math_abs (lua_State *L) {
40 if (lua_isinteger(L, 1)) { 40 if (lua_isinteger(L, 1)) {
41 lua_Integer n = lua_tointeger(L, 1); 41 lua_Integer n = lua_tointeger(L, 1);
42 if (n < 0) n = (lua_Integer)(0u - n); 42 if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n);
43 lua_pushinteger(L, n); 43 lua_pushinteger(L, n);
44 } 44 }
45 else 45 else