MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / codeorder

Function codeorder

third-party/lua-5.5.0/src/lcode.c:1634–1659  ·  view source on GitHub ↗

** Emit code for order comparisons. When using an immediate operand, ** 'isfloat' tells whether the original value was a float. */

Source from the content-addressed store, hash-verified

1632** 'isfloat' tells whether the original value was a float.
1633*/
1634static 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/*

Callers 1

luaK_posfixFunction · 0.70

Calls 5

isSCnumberFunction · 0.70
luaK_exp2anyregFunction · 0.70
binopr2opFunction · 0.70
freeexpsFunction · 0.70
condjumpFunction · 0.70

Tested by

no test coverage detected