Use logical instead of bitwise operators to save cpu