return true;
// Rule 2. Queen contact check is very dangerous
- if ( type_of(pc) == QUEEN
- && bit_is_set(kingAtt, to))
+ if (type_of(pc) == QUEEN && (kingAtt & to))
return true;
// Rule 3. Creating new double threats with checks
// Case 3: Moving through the vacated square
p2 = pos.piece_on(f2);
- if ( piece_is_slider(p2)
- && bit_is_set(squares_between(f2, t2), f1))
+ if (piece_is_slider(p2) && (squares_between(f2, t2) & f1))
return true;
// Case 4: The destination square for m2 is defended by the moving piece in m1
p1 = pos.piece_on(t1);
- if (bit_is_set(pos.attacks_from(p1, t1), t2))
+ if (pos.attacks_from(p1, t1) & t2)
return true;
// Case 5: Discovered check, checking piece is the piece moved in m1
ksq = pos.king_square(pos.side_to_move());
- if ( piece_is_slider(p1)
- && bit_is_set(squares_between(t1, ksq), f2))
+ if (piece_is_slider(p1) && (squares_between(t1, ksq) & f2))
{
Bitboard occ = pos.occupied_squares();
- xor_bit(&occ, f2);
- if (bit_is_set(pos.attacks_from(p1, t1, occ), ksq))
+ occ ^= f2;
+ if (pos.attacks_from(p1, t1, occ) & ksq)
return true;
}
return false;
// Case 3: If the moving piece in the threatened move is a slider, don't
// prune safe moves which block its ray.
- if ( piece_is_slider(pos.piece_on(tfrom))
- && bit_is_set(squares_between(tfrom, tto), mto)
- && pos.see_sign(m) >= 0)
+ if ( piece_is_slider(pos.piece_on(tfrom))
+ && (squares_between(tfrom, tto) & mto)
+ && pos.see_sign(m) >= 0)
return true;
return false;