** Code arithmetic operators ('+', '-', ...). If second operand is a ** constant in the proper range, use variant opcodes with K operands. */
| 1442 | ** constant in the proper range, use variant opcodes with K operands. |
| 1443 | */ |
| 1444 | static void codearith (FuncState *fs, BinOpr opr, |
| 1445 | expdesc *e1, expdesc *e2, int flip, int line) { |
| 1446 | TMS event = cast(TMS, opr + TM_ADD); |
| 1447 | if (tonumeral(e2, NULL) && luaK_exp2K(fs, e2)) { /* K operand? */ |
| 1448 | int v2 = e2->u.info; /* K index */ |
| 1449 | OpCode op = cast(OpCode, opr + OP_ADDK); |
| 1450 | finishbinexpval(fs, e1, e2, op, v2, flip, line, OP_MMBINK, event); |
| 1451 | } |
| 1452 | else { /* 'e2' is neither an immediate nor a K operand */ |
| 1453 | OpCode op = cast(OpCode, opr + OP_ADD); |
| 1454 | if (flip) |
| 1455 | swapexps(e1, e2); /* back to original order */ |
| 1456 | codebinexpval(fs, op, e1, e2, line); /* use standard operators */ |
| 1457 | } |
| 1458 | } |
| 1459 | |
| 1460 | |
| 1461 | /* |
no test coverage detected