From f62565abea4e56f6bd064df83e5b0f3818b99d82 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 9 Jun 2011 15:24:22 -0300 Subject: avoid warnings with -Wstrict-overflow --- ltable.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ltable.c') diff --git a/ltable.c b/ltable.c index e4ff8dd5..315fc61e 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.57 2011/05/31 18:27:56 roberto Exp roberto $ +** $Id: ltable.c,v 2.58 2011/06/02 19:31:40 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -88,8 +88,9 @@ static Node *hashnum (const Table *t, lua_Number n) { int i; luai_hashnum(i, n); if (i < 0) { - i = -i; /* must be a positive value */ - if (i < 0) i = 0; /* handle INT_MIN */ + if ((unsigned int)i == -(unsigned int)i) + i = 0; /* handle INT_MIN */ + i = -i; /* must be a positive value */ } return hashmod(t, i); } -- cgit v1.2.3-55-g6feb