Fix semantic of piece_attacks<PAWN>
authorMarco Costalba <mcostalba@gmail.com>
Sun, 13 Sep 2009 15:13:49 +0000 (16:13 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 13 Sep 2009 15:13:49 +0000 (16:13 +0100)
Return the bitboard with the pawn attacks for both colors
so to be aligned to the meaning of the others piece_attacks<Piece>
templates.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp
src/position.h

index 8ec82bebf6d8680d2b8c9015359b80864e7a8f35..462088e09c9dee5fc634f0d92fa38a2d5e306876 100644 (file)
@@ -667,7 +667,7 @@ inline void Position::update_checkers(Bitboard* pCheckersBB, Square ksq, Square
 
   else if (   Piece != KING
            && !Slider
-           && bit_is_set(piece_attacks<Piece>(ksq), to))
+           && bit_is_set(Piece == PAWN ? pawn_attacks(opposite_color(sideToMove), ksq) : piece_attacks<Piece>(ksq), to))
       set_bit(pCheckersBB, to);
 
   // Discovery checks
index 0006fbc772ca267e825d781c458e30ee28409c71..11cdc132e97621c6e25a422d2818468a1564da94 100644 (file)
@@ -457,7 +457,7 @@ inline Bitboard Position::piece_attacks(Square s) const {
 
 template<>
 inline Bitboard Position::piece_attacks<PAWN>(Square s) const {
-  return StepAttackBB[piece_of_color_and_type(opposite_color(sideToMove), PAWN)][s];
+  return StepAttackBB[WP][s] | StepAttackBB[BP][s];
 }
 
 template<>