MCPcopy Create free account
hub / github.com/axmolengine/axmol / codeeq

Function codeeq

3rdparty/lua/plainlua/lcode.c:1585–1610  ·  view source on GitHub ↗

** Emit code for equality comparisons ('==', '~='). ** 'e1' was already put as RK by 'luaK_infix'. */

Source from the content-addressed store, hash-verified

1583** 'e1' was already put as RK by 'luaK_infix'.
1584*/
1585static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
1586 int r1, r2;
1587 int im;
1588 int isfloat = 0; /* not needed here, but kept for symmetry */
1589 OpCode op;
1590 if (e1->k != VNONRELOC) {
1591 lua_assert(e1->k == VK || e1->k == VKINT || e1->k == VKFLT);
1592 swapexps(e1, e2);
1593 }
1594 r1 = luaK_exp2anyreg(fs, e1); /* 1st expression must be in register */
1595 if (isSCnumber(e2, &im, &isfloat)) {
1596 op = OP_EQI;
1597 r2 = im; /* immediate operand */
1598 }
1599 else if (exp2RK(fs, e2)) { /* 2nd expression is constant? */
1600 op = OP_EQK;
1601 r2 = e2->u.info; /* constant index */
1602 }
1603 else {
1604 op = OP_EQ; /* will compare two registers */
1605 r2 = luaK_exp2anyreg(fs, e2);
1606 }
1607 freeexps(fs, e1, e2);
1608 e1->u.info = condjump(fs, op, r1, r2, isfloat, (opr == OPR_EQ));
1609 e1->k = VJMP;
1610}
1611
1612
1613/*

Callers 1

luaK_posfixFunction · 0.85

Calls 6

swapexpsFunction · 0.85
luaK_exp2anyregFunction · 0.85
isSCnumberFunction · 0.85
exp2RKFunction · 0.85
freeexpsFunction · 0.85
condjumpFunction · 0.85

Tested by

no test coverage detected