Showing the changes to src/ltable.c (1 of 60 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: ltable.c,v 2.32 2006/01/18 11:49:02 roberto Exp $ | |
| 2 | +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ | |
| 3 | 3 | ** Lua tables (hash) |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -84,8 +84,8 @@ static const Node dummynode_ = { · 78 unmodified lines | ||
| 84 | 84 | static Node *hashnum (const Table *t, lua_Number n) { |
| 85 | 85 | unsigned int a[numints]; |
| 86 | 86 | int i; |
| 87 | − n += 1; /* normalize number (avoid -0) */ | |
| 88 | − lua_assert(sizeof(a) <= sizeof(n)); | |
| 87 | + if (luai_numeq(n, 0)) /* avoid problems with -0 */ | |
| 88 | + return gnode(t, 0); | |
| 89 | 89 | memcpy(a, &n, sizeof(a)); |
| 90 | 90 | for (i = 1; i < numints; i++) a[0] += a[i]; |
| 91 | 91 | return hashmod(t, a[0]); |