diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-02 12:39:23 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-02 12:39:23 -0300 |
| commit | dc4232379d79bc4ff5ad16bebf41793bb7ba6deb (patch) | |
| tree | 2abb8d71a297451f59946ced865f1204a363e768 | |
| parent | 10fffcd80abb2830935a5aa6b1bd1da9b1a77d97 (diff) | |
| download | lua-dc4232379d79bc4ff5ad16bebf41793bb7ba6deb.tar.gz lua-dc4232379d79bc4ff5ad16bebf41793bb7ba6deb.tar.bz2 lua-dc4232379d79bc4ff5ad16bebf41793bb7ba6deb.zip | |
detail (ensure subtraction is done unsigned)
| -rw-r--r-- | lmathlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -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 @@ | |||
| 39 | static int math_abs (lua_State *L) { | 39 | static 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 |
