** Emit code for order comparisons. When using an immediate operand, ** 'isfloat' tells whether the original value was a float. */
| 1550 | ** 'isfloat' tells whether the original value was a float. |
| 1551 | */ |
| 1552 | static void codeorder (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { |
| 1553 | int r1, r2; |
| 1554 | int im; |
| 1555 | int isfloat = 0; |
| 1556 | OpCode op; |
| 1557 | if (isSCnumber(e2, &im, &isfloat)) { |
| 1558 | /* use immediate operand */ |
| 1559 | r1 = luaK_exp2anyreg(fs, e1); |
| 1560 | r2 = im; |
| 1561 | op = binopr2op(opr, OPR_LT, OP_LTI); |
| 1562 | } |
| 1563 | else if (isSCnumber(e1, &im, &isfloat)) { |
| 1564 | /* transform (A < B) to (B > A) and (A <= B) to (B >= A) */ |
| 1565 | r1 = luaK_exp2anyreg(fs, e2); |
| 1566 | r2 = im; |
| 1567 | op = binopr2op(opr, OPR_LT, OP_GTI); |
| 1568 | } |
| 1569 | else { /* regular case, compare two registers */ |
| 1570 | r1 = luaK_exp2anyreg(fs, e1); |
| 1571 | r2 = luaK_exp2anyreg(fs, e2); |
| 1572 | op = binopr2op(opr, OPR_LT, OP_LT); |
| 1573 | } |
| 1574 | freeexps(fs, e1, e2); |
| 1575 | e1->u.info = condjump(fs, op, r1, r2, isfloat, 1); |
| 1576 | e1->k = VJMP; |
| 1577 | } |
| 1578 | |
| 1579 | |
| 1580 | /* |
no test coverage detected