X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=c3cff08dab598b98872f2faf3785e271018ebd9d;hp=e7678979f42450029c78d70cb0afe0d01358139e;hb=eb6d7f537d214c4dc8bde7d4fdc2aaead47dd3c3;hpb=79c97625a42c131708af953839900aff31102454 diff --git a/src/movegen.cpp b/src/movegen.cpp index e7678979..c3cff08d 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -28,6 +28,7 @@ namespace { template ExtMove* generate_castling(const Position& pos, ExtMove* moveList) { + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); constexpr CastlingRight Cr = Us | Cs; constexpr bool KingSide = (Cs == KING_SIDE); @@ -39,7 +40,7 @@ namespace { Square kfrom = pos.square(Us); Square rfrom = pos.castling_rook_square(Cr); Square kto = relative_square(Us, KingSide ? SQ_G1 : SQ_C1); - Bitboard enemies = pos.pieces(~Us); + Bitboard enemies = pos.pieces(Them); assert(!pos.checkers()); @@ -53,7 +54,7 @@ namespace { // Because we generate only legal castling moves we need to verify that // when moving the castling rook we do not discover some hidden checker. // For instance an enemy queen in SQ_A1 when castling rook is in SQ_B1. - if (Chess960 && (attacks_bb(kto, pos.pieces() ^ rfrom) & pos.pieces(~Us, ROOK, QUEEN))) + if (Chess960 && (attacks_bb(kto, pos.pieces() ^ rfrom) & pos.pieces(Them, ROOK, QUEEN))) return moveList; Move m = make(kfrom, rfrom); @@ -93,8 +94,7 @@ namespace { template ExtMove* generate_pawn_moves(const Position& pos, ExtMove* moveList, Bitboard target) { - // Compute our parametrized parameters at compile time, named according to - // the point of view of white side. + // Compute some compile time parameters relative to the white side constexpr Color Them = (Us == WHITE ? BLACK : WHITE); constexpr Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB); constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);