aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-15 12:43:34 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-15 12:43:34 -0300
commit7a543cfae613d7fa5f0cc82ef462310e5d3a4413 (patch)
tree0bc41f597df62c85c4f2abcdbbe288edb010e644 /lcode.c
parent24689927f2ef4d5bfe9f0d7deff08504eb31f81e (diff)
downloadlua-7a543cfae613d7fa5f0cc82ef462310e5d3a4413.tar.gz
lua-7a543cfae613d7fa5f0cc82ef462310e5d3a4413.tar.bz2
lua-7a543cfae613d7fa5f0cc82ef462310e5d3a4413.zip
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lcode.c b/lcode.c
index 16f5702a..5ff659d0 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.61 2012/08/14 18:12:34 roberto Exp roberto $ 2** $Id: lcode.c,v 2.62 2012/08/16 17:34:28 roberto Exp $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -293,9 +293,8 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
293 TValue *idx = luaH_set(L, fs->h, key); 293 TValue *idx = luaH_set(L, fs->h, key);
294 Proto *f = fs->f; 294 Proto *f = fs->f;
295 int k, oldsize; 295 int k, oldsize;
296 if (ttisnumber(idx)) { 296 if (ttisinteger(idx)) {
297 lua_Number n = nvalue(idx); 297 k = ivalue(idx);
298 lua_number2int(k, n);
299 if (luaV_rawequalobj(&f->k[k], v)) 298 if (luaV_rawequalobj(&f->k[k], v))
300 return k; 299 return k;
301 /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0"); 300 /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0");
@@ -306,7 +305,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
306 k = fs->nk; 305 k = fs->nk;
307 /* numerical value does not need GC barrier; 306 /* numerical value does not need GC barrier;
308 table has no metatable, so it does not need to invalidate cache */ 307 table has no metatable, so it does not need to invalidate cache */
309 setnvalue(idx, cast_num(k)); 308 setivalue(idx, k);
310 luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); 309 luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants");
311 while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); 310 while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
312 setobj(L, &f->k[k], v); 311 setobj(L, &f->k[k], v);