If you change logic and/or to bitwise and/or then it'll be branchless.
Do we know why the compiler doesn't do it? Surely the output is the same and avoiding branches is clearly faster.
Maybe short circuiting requires such an optimization not be made?