Consolidate CastlingSide and CastlingRights

This is a non-functional simplification that removes CastlingSide and
implements the functionality in CastlingRights (thanks to Jörg Oster
for a comment on the first version of this patch).

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 53854 W: 12077 L: 12019 D: 29758
http://tests.stockfishchess.org/tests/view/5d517b940ebc5925cf107474

Closes https://github.com/official-stockfish/Stockfish/pull/2265

No functional change
This commit is contained in:
protonspring
2019-08-12 08:42:28 -06:00
committed by Stéphane Nicolet
parent a016626825
commit 3984b8f8f0
5 changed files with 26 additions and 29 deletions

View 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));