MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / codeorder

Function codeorder

extlibs/lua/src/lcode.c:1492–1515  ·  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

1490** 'isfloat' tells whether the original value was a float.
1491*/
1492static void codeorder (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
1493 int r1, r2;
1494 int im;
1495 int isfloat = 0;
1496 if (isSCnumber(e2, &im, &isfloat)) {
1497 /* use immediate operand */
1498 r1 = luaK_exp2anyreg(fs, e1);
1499 r2 = im;
1500 op = cast(OpCode, (op - OP_LT) + OP_LTI);
1501 }
1502 else if (isSCnumber(e1, &im, &isfloat)) {
1503 /* transform (A < B) to (B > A) and (A <= B) to (B >= A) */
1504 r1 = luaK_exp2anyreg(fs, e2);
1505 r2 = im;
1506 op = (op == OP_LT) ? OP_GTI : OP_GEI;
1507 }
1508 else { /* regular case, compare two registers */
1509 r1 = luaK_exp2anyreg(fs, e1);
1510 r2 = luaK_exp2anyreg(fs, e2);
1511 }
1512 freeexps(fs, e1, e2);
1513 e1->u.info = condjump(fs, op, r1, r2, isfloat, 1);
1514 e1->k = VJMP;
1515}
1516
1517
1518/*

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