Properly constant-fold (0 or 123)

But not (0 and 123). Yay bug compatibility!
This commit is contained in:
GenericHeroGuy authored and Alug committed 2025-03-02 23:29:59 +01:00
1 parent fa07c4d659
commit 5b18c9837a
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;