diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.180 2013/08/29 13:49:57 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.181 2013/12/16 14:30:22 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -437,6 +437,7 @@ void luaV_finishOp (lua_State *L) { | |||
437 | OpCode op = GET_OPCODE(inst); | 437 | OpCode op = GET_OPCODE(inst); |
438 | switch (op) { /* finish its execution */ | 438 | switch (op) { /* finish its execution */ |
439 | case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: | 439 | case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: |
440 | case OP_BAND: case OP_BOR: case OP_BXOR: | ||
440 | case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN: | 441 | case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN: |
441 | case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { | 442 | case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { |
442 | setobjs2s(L, base + GETARG_A(inst), --L->top); | 443 | setobjs2s(L, base + GETARG_A(inst), --L->top); |
@@ -671,6 +672,33 @@ void luaV_execute (lua_State *L) { | |||
671 | } | 672 | } |
672 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } | 673 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } |
673 | ) | 674 | ) |
675 | vmcase(OP_BAND, | ||
676 | TValue *rb = RKB(i); | ||
677 | TValue *rc = RKC(i); | ||
678 | lua_Integer ib; lua_Integer ic; | ||
679 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | ||
680 | setivalue(ra, intop(&, ib, ic)); | ||
681 | } | ||
682 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); } | ||
683 | ) | ||
684 | vmcase(OP_BOR, | ||
685 | TValue *rb = RKB(i); | ||
686 | TValue *rc = RKC(i); | ||
687 | lua_Integer ib; lua_Integer ic; | ||
688 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | ||
689 | setivalue(ra, intop(|, ib, ic)); | ||
690 | } | ||
691 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); } | ||
692 | ) | ||
693 | vmcase(OP_BXOR, | ||
694 | TValue *rb = RKB(i); | ||
695 | TValue *rc = RKC(i); | ||
696 | lua_Integer ib; lua_Integer ic; | ||
697 | if (tointeger(rb, &ib) && tointeger(rc, &ic)) { | ||
698 | setivalue(ra, intop(^, ib, ic)); | ||
699 | } | ||
700 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); } | ||
701 | ) | ||
674 | vmcase(OP_MOD, | 702 | vmcase(OP_MOD, |
675 | TValue *rb = RKB(i); | 703 | TValue *rb = RKB(i); |
676 | TValue *rc = RKC(i); | 704 | TValue *rc = RKC(i); |