]> git.sesse.net Git - stockfish/blobdiff - src/bitboard.h
Introduce concept of double pawn protection.
[stockfish] / src / bitboard.h
index 559c70f62acf9e5f056d26f205fa6dc2aa24f38f..c6dbc647b093dfe1c8d5d425554a76161138adeb 100644 (file)
@@ -177,6 +177,16 @@ constexpr Bitboard pawn_attacks_bb(Bitboard b) {
 }
 
 
+/// double_pawn_attacks_bb() returns the pawn attacks for the given color
+/// from the squares in the given bitboard.
+
+template<Color C>
+constexpr Bitboard double_pawn_attacks_bb(Bitboard b) {
+  return C == WHITE ? shift<NORTH_WEST>(b) & shift<NORTH_EAST>(b)
+                    : shift<SOUTH_WEST>(b) & shift<SOUTH_EAST>(b);
+}
+
+
 /// adjacent_files_bb() returns a bitboard representing all the squares on the
 /// adjacent files of the given one.