** Code arithmetic operators ('+', '-', ...). If second operand is a ** constant in the proper range, use variant opcodes with K operands. */
| 1424 | ** constant in the proper range, use variant opcodes with K operands. |
| 1425 | */ |
| 1426 | static void codearith (FuncState *fs, BinOpr opr, |
| 1427 | expdesc *e1, expdesc *e2, int flip, int line) { |
| 1428 | TMS event = cast(TMS, opr + TM_ADD); |
| 1429 | if (tonumeral(e2, NULL) && luaK_exp2K(fs, e2)) { /* K operand? */ |
| 1430 | int v2 = e2->u.info; /* K index */ |
| 1431 | OpCode op = cast(OpCode, opr + OP_ADDK); |
| 1432 | finishbinexpval(fs, e1, e2, op, v2, flip, line, OP_MMBINK, event); |
| 1433 | } |
| 1434 | else { /* 'e2' is neither an immediate nor a K operand */ |
| 1435 | OpCode op = cast(OpCode, opr + OP_ADD); |
| 1436 | if (flip) |
| 1437 | swapexps(e1, e2); /* back to original order */ |
| 1438 | codebinexpval(fs, op, e1, e2, line); /* use standard operators */ |
| 1439 | } |
| 1440 | } |
| 1441 | |
| 1442 | |
| 1443 | /* |
no test coverage detected