Replace bitwise AND with logical AND