diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.199 2014/04/27 14:41:11 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.200 2014/04/29 18:11:57 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 | */ |
@@ -669,7 +669,7 @@ void luaV_execute (lua_State *L) { | |||
669 | setivalue(ra, intop(+, ib, ic)); | 669 | setivalue(ra, intop(+, ib, ic)); |
670 | } | 670 | } |
671 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 671 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
672 | setnvalue(ra, luai_numadd(L, nb, nc)); | 672 | setfltvalue(ra, luai_numadd(L, nb, nc)); |
673 | } | 673 | } |
674 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } | 674 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } |
675 | ) | 675 | ) |
@@ -682,7 +682,7 @@ void luaV_execute (lua_State *L) { | |||
682 | setivalue(ra, intop(-, ib, ic)); | 682 | setivalue(ra, intop(-, ib, ic)); |
683 | } | 683 | } |
684 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 684 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
685 | setnvalue(ra, luai_numsub(L, nb, nc)); | 685 | setfltvalue(ra, luai_numsub(L, nb, nc)); |
686 | } | 686 | } |
687 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } | 687 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } |
688 | ) | 688 | ) |
@@ -695,7 +695,7 @@ void luaV_execute (lua_State *L) { | |||
695 | setivalue(ra, intop(*, ib, ic)); | 695 | setivalue(ra, intop(*, ib, ic)); |
696 | } | 696 | } |
697 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 697 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
698 | setnvalue(ra, luai_nummul(L, nb, nc)); | 698 | setfltvalue(ra, luai_nummul(L, nb, nc)); |
699 | } | 699 | } |
700 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } | 700 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } |
701 | ) | 701 | ) |
@@ -704,7 +704,7 @@ void luaV_execute (lua_State *L) { | |||
704 | TValue *rc = RKC(i); | 704 | TValue *rc = RKC(i); |
705 | lua_Number nb; lua_Number nc; | 705 | lua_Number nb; lua_Number nc; |
706 | if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 706 | if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
707 | setnvalue(ra, luai_numdiv(L, nb, nc)); | 707 | setfltvalue(ra, luai_numdiv(L, nb, nc)); |
708 | } | 708 | } |
709 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } | 709 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } |
710 | ) | 710 | ) |
@@ -773,7 +773,7 @@ void luaV_execute (lua_State *L) { | |||
773 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 773 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
774 | lua_Number m; | 774 | lua_Number m; |
775 | luai_nummod(L, nb, nc, m); | 775 | luai_nummod(L, nb, nc, m); |
776 | setnvalue(ra, m); | 776 | setfltvalue(ra, m); |
777 | } | 777 | } |
778 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } | 778 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } |
779 | ) | 779 | ) |
@@ -787,7 +787,7 @@ void luaV_execute (lua_State *L) { | |||
787 | setivalue(ra, luaV_pow(ib, ic)); | 787 | setivalue(ra, luaV_pow(ib, ic)); |
788 | } | 788 | } |
789 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { | 789 | else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
790 | setnvalue(ra, luai_numpow(L, nb, nc)); | 790 | setfltvalue(ra, luai_numpow(L, nb, nc)); |
791 | } | 791 | } |
792 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } | 792 | else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } |
793 | ) | 793 | ) |
@@ -799,7 +799,7 @@ void luaV_execute (lua_State *L) { | |||
799 | setivalue(ra, intop(-, 0, ib)); | 799 | setivalue(ra, intop(-, 0, ib)); |
800 | } | 800 | } |
801 | else if (tonumber(rb, &nb)) { | 801 | else if (tonumber(rb, &nb)) { |
802 | setnvalue(ra, luai_numunm(L, nb)); | 802 | setfltvalue(ra, luai_numunm(L, nb)); |
803 | } | 803 | } |
804 | else { | 804 | else { |
805 | Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); | 805 | Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); |
@@ -955,8 +955,8 @@ void luaV_execute (lua_State *L) { | |||
955 | if (luai_numlt(0, step) ? luai_numle(idx, limit) | 955 | if (luai_numlt(0, step) ? luai_numle(idx, limit) |
956 | : luai_numle(limit, idx)) { | 956 | : luai_numle(limit, idx)) { |
957 | ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ | 957 | ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ |
958 | setnvalue(ra, idx); /* update internal index... */ | 958 | setfltvalue(ra, idx); /* update internal index... */ |
959 | setnvalue(ra + 3, idx); /* ...and external index */ | 959 | setfltvalue(ra + 3, idx); /* ...and external index */ |
960 | } | 960 | } |
961 | } | 961 | } |
962 | ) | 962 | ) |
@@ -975,13 +975,13 @@ void luaV_execute (lua_State *L) { | |||
975 | lua_Number ninit; lua_Number nlimit; lua_Number nstep; | 975 | lua_Number ninit; lua_Number nlimit; lua_Number nstep; |
976 | if (!tonumber(plimit, &nlimit)) | 976 | if (!tonumber(plimit, &nlimit)) |
977 | luaG_runerror(L, LUA_QL("for") " limit must be a number"); | 977 | luaG_runerror(L, LUA_QL("for") " limit must be a number"); |
978 | setnvalue(plimit, nlimit); | 978 | setfltvalue(plimit, nlimit); |
979 | if (!tonumber(pstep, &nstep)) | 979 | if (!tonumber(pstep, &nstep)) |
980 | luaG_runerror(L, LUA_QL("for") " step must be a number"); | 980 | luaG_runerror(L, LUA_QL("for") " step must be a number"); |
981 | setnvalue(pstep, nstep); | 981 | setfltvalue(pstep, nstep); |
982 | if (!tonumber(init, &ninit)) | 982 | if (!tonumber(init, &ninit)) |
983 | luaG_runerror(L, LUA_QL("for") " initial value must be a number"); | 983 | luaG_runerror(L, LUA_QL("for") " initial value must be a number"); |
984 | setnvalue(init, luai_numsub(L, ninit, nstep)); | 984 | setfltvalue(init, luai_numsub(L, ninit, nstep)); |
985 | } | 985 | } |
986 | ci->u.l.savedpc += GETARG_sBx(i); | 986 | ci->u.l.savedpc += GETARG_sBx(i); |
987 | ) | 987 | ) |