** Emit code for order comparisons. When using an immediate operand, ** 'isfloat' tells whether the original value was a float. */
| 1632 | ** 'isfloat' tells whether the original value was a float. |
| 1633 | */ |
| 1634 | static void codeorder (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { |
| 1635 | int r1, r2; |
| 1636 | int im; |
| 1637 | int isfloat = 0; |
| 1638 | OpCode op; |
| 1639 | if (isSCnumber(e2, &im, &isfloat)) { |
| 1640 | /* use immediate operand */ |
| 1641 | r1 = luaK_exp2anyreg(fs, e1); |
| 1642 | r2 = im; |
| 1643 | op = binopr2op(opr, OPR_LT, OP_LTI); |
| 1644 | } |
| 1645 | else if (isSCnumber(e1, &im, &isfloat)) { |
| 1646 | /* transform (A < B) to (B > A) and (A <= B) to (B >= A) */ |
| 1647 | r1 = luaK_exp2anyreg(fs, e2); |
| 1648 | r2 = im; |
| 1649 | op = binopr2op(opr, OPR_LT, OP_GTI); |
| 1650 | } |
| 1651 | else { /* regular case, compare two registers */ |
| 1652 | r1 = luaK_exp2anyreg(fs, e1); |
| 1653 | r2 = luaK_exp2anyreg(fs, e2); |
| 1654 | op = binopr2op(opr, OPR_LT, OP_LT); |
| 1655 | } |
| 1656 | freeexps(fs, e1, e2); |
| 1657 | e1->u.info = condjump(fs, op, r1, r2, isfloat, 1); |
| 1658 | e1->k = VJMP; |
| 1659 | } |
| 1660 | |
| 1661 | |
| 1662 | /* |
no test coverage detected