** Emit code for order comparisons. When using an immediate operand, ** 'isfloat' tells whether the original value was a float. */
| 1774 | ** 'isfloat' tells whether the original value was a float. |
| 1775 | */ |
| 1776 | static void codeorder (FuncState *fs, BinOpr opr, expdesc *res, expdesc *e1, expdesc *e2) { |
| 1777 | int r1, r2; |
| 1778 | int im; |
| 1779 | int isfloat = 0; |
| 1780 | OpCode op; |
| 1781 | if (isSCnumber(e2, &im, &isfloat)) { |
| 1782 | /* use immediate operand */ |
| 1783 | r1 = luaK_exp2anyreg(fs, e1); |
| 1784 | r2 = im; |
| 1785 | op = binopr2op(opr, OPR_LT, OP_LTI); |
| 1786 | } |
| 1787 | else if (isSCnumber(e1, &im, &isfloat)) { |
| 1788 | /* transform (A < B) to (B > A) and (A <= B) to (B >= A) */ |
| 1789 | r1 = luaK_exp2anyreg(fs, e2); |
| 1790 | r2 = im; |
| 1791 | op = binopr2op(opr, OPR_LT, OP_GTI); |
| 1792 | } |
| 1793 | else { /* regular case, compare two registers */ |
| 1794 | r1 = luaK_exp2anyreg(fs, e1); |
| 1795 | r2 = luaK_exp2anyreg(fs, e2); |
| 1796 | op = binopr2op(opr, OPR_LT, OP_LT); |
| 1797 | } |
| 1798 | freeexps(fs, e1, e2); |
| 1799 | res->u.pc = condjump(fs, op, r1, r2, isfloat, 1); |
| 1800 | res->k = VJMP; |
| 1801 | } |
| 1802 | |
| 1803 | |
| 1804 | /* |
no test coverage detected