]> git.sesse.net Git - stockfish/blobdiff - src/movegen.cpp
Consolidate CastlingSide and CastlingRights
[stockfish] / src / movegen.cpp
index 4c609352358cbbf797aa8b0805dbc1e98e7b7e56..fc99ec26611a53f6701d3d3b6a58461da43c7372 100644 (file)
@@ -219,8 +219,8 @@ namespace {
   template<Color Us, GenType Type>
   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<Us, Type>(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<CASTLING>(ksq, pos.castling_rook_square(OO));