MCPcopy Create free account
hub / github.com/danomatika/ofxLua / codeorder

Function codeorder

libs/lua/lcode.c:1549–1574  ·  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

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

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