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

Function codebitwise

lua/src/lcode.c:1484–1503  ·  view source on GitHub ↗

** Code bitwise operations; they are all associative, so the function ** tries to put an integer constant as the 2nd operand (a K operand). */

Source from the content-addressed store, hash-verified

1482** tries to put an integer constant as the 2nd operand (a K operand).
1483*/
1484static void codebitwise (FuncState *fs, BinOpr opr,
1485 expdesc *e1, expdesc *e2, int line) {
1486 int flip = 0;
1487 int v2;
1488 OpCode op;
1489 if (e1->k == VKINT && luaK_exp2RK(fs, e1)) {
1490 swapexps(e1, e2); /* 'e2' will be the constant operand */
1491 flip = 1;
1492 }
1493 else if (!(e2->k == VKINT && luaK_exp2RK(fs, e2))) { /* no constants? */
1494 op = cast(OpCode, opr + OP_ADD);
1495 codebinexpval(fs, op, e1, e2, line); /* all-register opcodes */
1496 return;
1497 }
1498 v2 = e2->u.info; /* index in K array */
1499 op = cast(OpCode, opr + OP_ADDK);
1500 lua_assert(ttisinteger(&fs->f->k[v2]));
1501 finishbinexpval(fs, e1, e2, op, v2, flip, line, OP_MMBINK,
1502 cast(TMS, opr + TM_ADD));
1503}
1504
1505
1506/*

Callers 1

luaK_posfixFunction · 0.85

Calls 4

luaK_exp2RKFunction · 0.85
swapexpsFunction · 0.85
codebinexpvalFunction · 0.85
finishbinexpvalFunction · 0.85

Tested by

no test coverage detected