X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=fc99ec26611a53f6701d3d3b6a58461da43c7372;hp=2f7c55c8640bda0f93923c5b480241ac84471386;hb=e5cfa14f40a38d99d11a9c048c34858e3145fbcd;hpb=3732c55c18fd74981370dc55b7b46ec8a05ad5bf diff --git a/src/movegen.cpp b/src/movegen.cpp index 2f7c55c8..fc99ec26 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -219,8 +219,8 @@ namespace { template ExtMove* generate_all(const Position& pos, ExtMove* moveList, Bitboard target) { - constexpr CastlingRight OO = Us | KING_SIDE; - constexpr CastlingRight OOO = Us | QUEEN_SIDE; + constexpr CastlingRights OO = Us & KING_SIDE; + constexpr CastlingRights OOO = Us & QUEEN_SIDE; constexpr bool Checks = Type == QUIET_CHECKS; // Reduce template instantations moveList = generate_pawn_moves(pos, moveList, target); @@ -236,7 +236,7 @@ namespace { while (b) *moveList++ = make_move(ksq, pop_lsb(&b)); - if (Type != CAPTURES && pos.can_castle(CastlingRight(OO | OOO))) + if (Type != CAPTURES && pos.can_castle(CastlingRights(OO | OOO))) { if (!pos.castling_impeded(OO) && pos.can_castle(OO)) *moveList++ = make(ksq, pos.castling_rook_square(OO)); @@ -252,14 +252,11 @@ namespace { } // namespace -/// generate generates all pseudo-legal captures and queen -/// promotions. Returns a pointer to the end of the move list. +/// Generates all pseudo-legal captures and queen promotions +/// Generates all pseudo-legal non-captures and underpromotions +/// Generates all pseudo-legal captures and non-captures /// -/// generate generates all pseudo-legal non-captures and -/// underpromotions. Returns a pointer to the end of the move list. -/// -/// generate generates all pseudo-legal captures and -/// non-captures. Returns a pointer to the end of the move list. +/// Returns a pointer to the end of the move list. template ExtMove* generate(const Position& pos, ExtMove* moveList) {