From 06cc71b6c53eabbd872982f9c0cc9130ae0d8cbd Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 9 Aug 2022 18:34:01 +0100 Subject: [PATCH] VarAction2: Mark suitable AND ops as jump insertion candidates --- src/newgrf.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 7f2b6264b6..ad973c8649 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -6907,6 +6907,10 @@ static void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSp state.inference = VA2AIF_SIGNED_NON_NEGATIVE; } state.inference |= non_const_var_inference; + if ((state.inference & VA2AIF_ONE_OR_ZERO) && (prev_inference & VA2AIF_ONE_OR_ZERO)) { + adjust.adjust_flags |= DSGAF_JUMP_INS_HINT; + group->dsg_flags |= DSGF_CHECK_INSERT_JUMP; + } try_merge_with_previous(); break; case DSGA_OP_OR: