X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;fp=src%2Fbitboard.h;h=15ec4153362d82d1339e9657e19190cf2e118005;hp=afeb40ec146f2af01d2626111fe19450148c90f3;hb=1f3bd968bb194a1f42af661cca9ec445c13978e8;hpb=5e91c5dcc8066e9f346a10010ddce70f2d317ef6 diff --git a/src/bitboard.h b/src/bitboard.h index afeb40ec..15ec4153 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -130,6 +130,13 @@ constexpr bool more_than_one(Bitboard b) { return b & (b - 1); } +/// Counts the occupation of the bitboard depending on the occupation of SQ_A1 +/// as in `b & (1ULL << SQ_A1) ? more_than_two(b) : more_than_one(b)` + +constexpr bool conditional_more_than_two(Bitboard b) { + return b & (b - 1) & (b - 2); +} + constexpr bool opposite_colors(Square s1, Square s2) { return (s1 + rank_of(s1) + s2 + rank_of(s2)) & 1; }