** Code bitwise operations; they are all associative, so the function ** tries to put an integer constant as the 2nd operand (a K operand). */
| 1464 | ** tries to put an integer constant as the 2nd operand (a K operand). |
| 1465 | */ |
| 1466 | static void codebitwise (FuncState *fs, BinOpr opr, |
| 1467 | expdesc *e1, expdesc *e2, int line) { |
| 1468 | int flip = 0; |
| 1469 | int v2; |
| 1470 | OpCode op; |
| 1471 | if (e1->k == VKINT && luaK_exp2RK(fs, e1)) { |
| 1472 | swapexps(e1, e2); /* 'e2' will be the constant operand */ |
| 1473 | flip = 1; |
| 1474 | } |
| 1475 | else if (!(e2->k == VKINT && luaK_exp2RK(fs, e2))) { /* no constants? */ |
| 1476 | op = cast(OpCode, opr + OP_ADD); |
| 1477 | codebinexpval(fs, op, e1, e2, line); /* all-register opcodes */ |
| 1478 | return; |
| 1479 | } |
| 1480 | v2 = e2->u.info; /* index in K array */ |
| 1481 | op = cast(OpCode, opr + OP_ADDK); |
| 1482 | lua_assert(ttisinteger(&fs->f->k[v2])); |
| 1483 | finishbinexpval(fs, e1, e2, op, v2, flip, line, OP_MMBINK, |
| 1484 | cast(TMS, opr + TM_ADD)); |
| 1485 | } |
| 1486 | |
| 1487 | |
| 1488 | /* |
no test coverage detected