mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 15:37:47 +00:00
Bitwise operator overloads between Bitboard and Square
Yes, we try to be fancy here ;-) No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
+9
-12
@@ -1363,8 +1363,7 @@ split_point_start: // At split points actual search starts from here
|
||||
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
|
||||
@@ -1419,23 +1418,21 @@ split_point_start: // At split points actual search starts from here
|
||||
|
||||
// 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;
|
||||
@@ -1505,9 +1502,9 @@ split_point_start: // At split points actual search starts from here
|
||||
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user