Properly constant-fold (0 or 123)

But not (0 and 123). Yay bug compatibility!
This commit is contained in:
GenericHeroGuy authored and Indev committed 2025-03-03 01:34:24 +03:00
1 parent 3ce78064ed
commit 40d0d9d2b8
1 file changed
+5 -1
+5 -1
View File
@@ -782,7 +782,11 @@ static void bcemit_branch_f(FuncState *fs, ExpDesc *e)
{
BCPos pc;
expr_discharge(fs, e);
if (e->k == VKNIL || e->k == VKFALSE)
if (e->k == VKNIL || e->k == VKFALSE
#if LJ_INTONLY
|| (expr_isnumk_nojump(e) && expr_intV(e) == 0)
#endif
)
pc = NO_JMP; /* Never jump. */
else if (e->k == VJMP)
pc = e->u.s.info;