MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / codeorder

Function codeorder

lua/src/lcode.c:1510–1533  ·  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

1508** 'isfloat' tells whether the original value was a float.
1509*/
1510static void codeorder (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
1511 int r1, r2;
1512 int im;
1513 int isfloat = 0;
1514 if (isSCnumber(e2, &im, &isfloat)) {
1515 /* use immediate operand */
1516 r1 = luaK_exp2anyreg(fs, e1);
1517 r2 = im;
1518 op = cast(OpCode, (op - OP_LT) + OP_LTI);
1519 }
1520 else if (isSCnumber(e1, &im, &isfloat)) {
1521 /* transform (A < B) to (B > A) and (A <= B) to (B >= A) */
1522 r1 = luaK_exp2anyreg(fs, e2);
1523 r2 = im;
1524 op = (op == OP_LT) ? OP_GTI : OP_GEI;
1525 }
1526 else { /* regular case, compare two registers */
1527 r1 = luaK_exp2anyreg(fs, e1);
1528 r2 = luaK_exp2anyreg(fs, e2);
1529 }
1530 freeexps(fs, e1, e2);
1531 e1->u.info = condjump(fs, op, r1, r2, isfloat, 1);
1532 e1->k = VJMP;
1533}
1534
1535
1536/*

Callers 1

luaK_posfixFunction · 0.85

Calls 4

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

Tested by

no test coverage detected