macros cast_integer/cast_unsigned replaced by cast_u2s/cast_s2u, that

should be used only between lua_Integer and lua_Unsigned
This commit is contained in:
Roberto Ierusalimschy
2014-04-15 11:29:30 -03:00
parent 5c46b7b8cf
commit 8f961da3db
7 changed files with 33 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.85 2014/04/01 14:39:55 roberto Exp roberto $
** $Id: ltable.c,v 2.86 2014/04/13 21:11:19 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -472,7 +472,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
*/
const TValue *luaH_getint (Table *t, lua_Integer key) {
/* (1 <= key && key <= t->sizearray) */
if (cast_unsigned(key - 1) < cast_unsigned(t->sizearray))
if (cast_s2u(key - 1) < cast(unsigned int, t->sizearray))
return &t->array[key - 1];
else {
Node *n = hashint(t, key);