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

Function codeorder

third-party/lua-5.4.6/src/lcode.c:1553–1578  ·  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

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

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