On Tue, 2024-01-02 at 12:36 -0800, Maciej Żenczykowski wrote: [...] > > I wonder if JEQ/JNE couldn't simply be folded into the existing cases though... > Or perhaps some other refactoring to tri-state the jmps... > > switch (opcode) { > case BPF_JEQ: eq_branch = this_branch; lt_branch = gt_branch = > other_branch; break; > case BPF_JNE: lt_branch = gt_branch = this_branch; eq_branch = > other_branch; break; > case BPF_LT: lt_branch = this_branch; eq_branch = gt_branch = > other_branch; break; > ... > } > and then you can ignore opcode... The code could probably be simplified a bit (actually, I'm thinking about pulling all dst/src type checks as bool variables at the beginning). Suppose Andrii accepts this change, would you want to submit the patch? (or I can wrap-up what I have).