diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-22 16:41:20 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-22 16:41:20 -0200 |
commit | 41f2936d8f2ec3894e0ef013f6b9e8f6ea17c181 (patch) | |
tree | 7796c2687563ed326aa977774406ca6569200a4f /lvm.c | |
parent | 14c3aa12b5a609f45b9be49e11ee862f9193a014 (diff) | |
download | lua-41f2936d8f2ec3894e0ef013f6b9e8f6ea17c181.tar.gz lua-41f2936d8f2ec3894e0ef013f6b9e8f6ea17c181.tar.bz2 lua-41f2936d8f2ec3894e0ef013f6b9e8f6ea17c181.zip |
new opcode 'OP_EQI' for equality with immediate numbers
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.312 2017/11/20 12:57:39 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.313 2017/11/21 14:17:35 roberto Exp $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1392,6 +1392,17 @@ void luaV_execute (lua_State *L) { | |||
1392 | donextjump(ci); | 1392 | donextjump(ci); |
1393 | vmbreak; | 1393 | vmbreak; |
1394 | } | 1394 | } |
1395 | vmcase(OP_EQI) { | ||
1396 | TValue *rb = vRB(i); | ||
1397 | int ic = GETARG_sC(i); | ||
1398 | if ((ttisinteger(rb) ? (ivalue(rb) == ic) | ||
1399 | :ttisfloat(rb) ? luai_numeq(fltvalue(rb), cast_num(ic)) | ||
1400 | : 0) != GETARG_A(i)) | ||
1401 | pc++; | ||
1402 | else | ||
1403 | donextjump(ci); | ||
1404 | vmbreak; | ||
1405 | } | ||
1395 | vmcase(OP_TEST) { | 1406 | vmcase(OP_TEST) { |
1396 | if (GETARG_C(i) ? l_isfalse(s2v(ra)) : !l_isfalse(s2v(ra))) | 1407 | if (GETARG_C(i) ? l_isfalse(s2v(ra)) : !l_isfalse(s2v(ra))) |
1397 | pc++; | 1408 | pc++; |