diff options
| -rw-r--r-- | lapi.c | 6 | ||||
| -rw-r--r-- | llimits.h | 5 | ||||
| -rw-r--r-- | lparser.c | 4 |
3 files changed, 11 insertions, 4 deletions
| @@ -38,7 +38,11 @@ const char lua_ident[] = | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | /* test for a valid index */ | 41 | /* |
| 42 | ** Test for a valid index. | ||
| 43 | ** '!ttisnil(o)' implies 'o != &G(L)->nilvalue', so it is not needed. | ||
| 44 | ** However, it covers the most common cases in a faster way. | ||
| 45 | */ | ||
| 42 | #define isvalid(L, o) (!ttisnil(o) || o != &G(L)->nilvalue) | 46 | #define isvalid(L, o) (!ttisnil(o) || o != &G(L)->nilvalue) |
| 43 | 47 | ||
| 44 | 48 | ||
| @@ -298,7 +298,10 @@ typedef unsigned long Instruction; | |||
| 298 | ** so it is better to use 'fmod'. 'fmod' gives the result of | 298 | ** so it is better to use 'fmod'. 'fmod' gives the result of |
| 299 | ** 'a - trunc(a/b)*b', and therefore must be corrected when | 299 | ** 'a - trunc(a/b)*b', and therefore must be corrected when |
| 300 | ** 'trunc(a/b) ~= floor(a/b)'. That happens when the division has a | 300 | ** 'trunc(a/b) ~= floor(a/b)'. That happens when the division has a |
| 301 | ** non-integer negative result, which is equivalent to the tests below. | 301 | ** non-integer negative result: non-integer result is equivalent to |
| 302 | ** a non-zero remainder 'm'; negative result is equivalent to 'a' and | ||
| 303 | ** 'b' with different signs, or 'm' and 'b' with different signs | ||
| 304 | ** (as the result 'm' of 'fmod' has the same sign of 'a'). | ||
| 302 | */ | 305 | */ |
| 303 | #if !defined(luai_nummod) | 306 | #if !defined(luai_nummod) |
| 304 | #define luai_nummod(L,a,b,m) \ | 307 | #define luai_nummod(L,a,b,m) \ |
| @@ -1171,9 +1171,9 @@ static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { | |||
| 1171 | suffixedexp(ls, &nv.v); | 1171 | suffixedexp(ls, &nv.v); |
| 1172 | if (!vkisindexed(nv.v.k)) | 1172 | if (!vkisindexed(nv.v.k)) |
| 1173 | check_conflict(ls, lh, &nv.v); | 1173 | check_conflict(ls, lh, &nv.v); |
| 1174 | luaE_incCcalls(ls->L); /* control recursion depth */ | 1174 | enterlevel(ls); /* control recursion depth */ |
| 1175 | assignment(ls, &nv, nvars+1); | 1175 | assignment(ls, &nv, nvars+1); |
| 1176 | ls->L->nCcalls--; | 1176 | leavelevel(ls); |
| 1177 | } | 1177 | } |
| 1178 | else { /* assignment -> '=' explist */ | 1178 | else { /* assignment -> '=' explist */ |
| 1179 | int nexps; | 1179 | int nexps; |
