reordered some boolean expressions

Reordered boolean expressions. Measured speed increase with bench depth 15 on my system is about 1-2%.