MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / codeorder

Function codeorder

lib/lua/src/lcode.c:1552–1577  ·  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

1550** 'isfloat' tells whether the original value was a float.
1551*/
1552static 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/*

Callers 1

luaK_posfixFunction · 0.85

Calls 5

isSCnumberFunction · 0.85
luaK_exp2anyregFunction · 0.85
binopr2opFunction · 0.85
freeexpsFunction · 0.85
condjumpFunction · 0.85

Tested by

no test coverage detected