diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-24 11:30:46 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-24 11:30:46 -0300 |
| commit | 31925e4cc20018b2cf46664febd6347ce4a4b766 (patch) | |
| tree | 159667853fbe827acdce92923fa34d401b1a89ec | |
| parent | 59c88f846d1dcd901a4420651aedf27816618923 (diff) | |
| download | lua-31925e4cc20018b2cf46664febd6347ce4a4b766.tar.gz lua-31925e4cc20018b2cf46664febd6347ce4a4b766.tar.bz2 lua-31925e4cc20018b2cf46664febd6347ce4a4b766.zip | |
Details
Added documentation and asserts that constants for arithmetic opcodes
must be numbers.
| -rw-r--r-- | lopcodes.h | 14 | ||||
| -rw-r--r-- | lvm.c | 4 |
2 files changed, 9 insertions, 9 deletions
| @@ -225,13 +225,13 @@ OP_SELF,/* A B C R[A+1] := R[B]; R[A] := R[B][RK(C):string] */ | |||
| 225 | 225 | ||
| 226 | OP_ADDI,/* A B sC R[A] := R[B] + sC */ | 226 | OP_ADDI,/* A B sC R[A] := R[B] + sC */ |
| 227 | 227 | ||
| 228 | OP_ADDK,/* A B C R[A] := R[B] + K[C] */ | 228 | OP_ADDK,/* A B C R[A] := R[B] + K[C]:number */ |
| 229 | OP_SUBK,/* A B C R[A] := R[B] - K[C] */ | 229 | OP_SUBK,/* A B C R[A] := R[B] - K[C]:number */ |
| 230 | OP_MULK,/* A B C R[A] := R[B] * K[C] */ | 230 | OP_MULK,/* A B C R[A] := R[B] * K[C]:number */ |
| 231 | OP_MODK,/* A B C R[A] := R[B] % K[C] */ | 231 | OP_MODK,/* A B C R[A] := R[B] % K[C]:number */ |
| 232 | OP_POWK,/* A B C R[A] := R[B] ^ K[C] */ | 232 | OP_POWK,/* A B C R[A] := R[B] ^ K[C]:number */ |
| 233 | OP_DIVK,/* A B C R[A] := R[B] / K[C] */ | 233 | OP_DIVK,/* A B C R[A] := R[B] / K[C]:number */ |
| 234 | OP_IDIVK,/* A B C R[A] := R[B] // K[C] */ | 234 | OP_IDIVK,/* A B C R[A] := R[B] // K[C]:number */ |
| 235 | 235 | ||
| 236 | OP_BANDK,/* A B C R[A] := R[B] & K[C]:integer */ | 236 | OP_BANDK,/* A B C R[A] := R[B] & K[C]:integer */ |
| 237 | OP_BORK,/* A B C R[A] := R[B] | K[C]:integer */ | 237 | OP_BORK,/* A B C R[A] := R[B] | K[C]:integer */ |
| @@ -921,7 +921,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 921 | */ | 921 | */ |
| 922 | #define op_arithfK(L,fop) { \ | 922 | #define op_arithfK(L,fop) { \ |
| 923 | TValue *v1 = vRB(i); \ | 923 | TValue *v1 = vRB(i); \ |
| 924 | TValue *v2 = KC(i); \ | 924 | TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \ |
| 925 | op_arithf_aux(L, v1, v2, fop); } | 925 | op_arithf_aux(L, v1, v2, fop); } |
| 926 | 926 | ||
| 927 | 927 | ||
| @@ -950,7 +950,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 950 | */ | 950 | */ |
| 951 | #define op_arithK(L,iop,fop) { \ | 951 | #define op_arithK(L,iop,fop) { \ |
| 952 | TValue *v1 = vRB(i); \ | 952 | TValue *v1 = vRB(i); \ |
| 953 | TValue *v2 = KC(i); \ | 953 | TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \ |
| 954 | op_arith_aux(L, v1, v2, iop, fop); } | 954 | op_arith_aux(L, v1, v2, iop, fop); } |
| 955 | 955 | ||
| 956 | 956 | ||
