X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=5cafcfcc1a7987e62852e3778d780e2015887e38;hp=c9f724277a6f5d5efabc82d0958396741a6aa35e;hb=52f92d05a9eae0cc68a3cd157f8df35802a98297;hpb=820c5c25b649d6bdd51bed14a16efdc11719b588 diff --git a/src/bitboard.h b/src/bitboard.h index c9f72427..5cafcfcc 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -160,6 +160,14 @@ constexpr Bitboard shift(Bitboard b) { : 0; } +/// pawn_attacks_bb() returns the pawn attacks for the given color from the +/// squares in the given bitboard. + +template +constexpr Bitboard pawn_attacks_bb(Bitboard b) { + return c == WHITE ? shift(b) | shift(b) + : shift(b) | shift(b); +} /// adjacent_files_bb() returns a bitboard representing all the squares on the /// adjacent files of the given one.