diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-15 13:32:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-15 13:32:49 -0300 |
commit | 037a70dfea9de66e8d27c8d3ce2ed9f159a1b094 (patch) | |
tree | a31c77b6da44e543a1ec01f916e31d99fb64b238 /lobject.c | |
parent | 8f961da3dbf8c45389d1431e6dff8e44e41f1a57 (diff) | |
download | lua-037a70dfea9de66e8d27c8d3ce2ed9f159a1b094.tar.gz lua-037a70dfea9de66e8d27c8d3ce2ed9f159a1b094.tar.bz2 lua-037a70dfea9de66e8d27c8d3ce2ed9f159a1b094.zip |
cast_u2s/cast_s2u renamed l_castS2U/l_castU2S to be configurable from
outside (mostly for testing)
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.78 2014/04/11 19:52:26 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.79 2014/04/15 14:28:20 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -85,7 +85,7 @@ static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, | |||
85 | case LUA_OPSHL: return luaV_shiftl(v1, v2); | 85 | case LUA_OPSHL: return luaV_shiftl(v1, v2); |
86 | case LUA_OPSHR: return luaV_shiftl(v1, -v2); | 86 | case LUA_OPSHR: return luaV_shiftl(v1, -v2); |
87 | case LUA_OPUNM: return intop(-, 0, v1); | 87 | case LUA_OPUNM: return intop(-, 0, v1); |
88 | case LUA_OPBNOT: return intop(^, ~cast_s2u(0), v1); | 88 | case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); |
89 | default: lua_assert(0); return 0; | 89 | default: lua_assert(0); return 0; |
90 | } | 90 | } |
91 | } | 91 | } |
@@ -291,7 +291,7 @@ int luaO_str2int (const char *s, size_t len, lua_Integer *result) { | |||
291 | while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ | 291 | while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ |
292 | if (empty || s != ends) return 0; /* something wrong in the numeral */ | 292 | if (empty || s != ends) return 0; /* something wrong in the numeral */ |
293 | else { | 293 | else { |
294 | *result = cast_u2s((neg) ? 0u - a : a); | 294 | *result = l_castU2S((neg) ? 0u - a : a); |
295 | return 1; | 295 | return 1; |
296 | } | 296 | } |
297 | } | 297 | } |