From: Marco Costalba Date: Sat, 26 May 2012 09:11:59 +0000 (+0100) Subject: Fix book file regression X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=6c9c6dd989b037992f789ea182cafb630ca77f7c;ds=sidebyside Fix book file regression Revision 2aac860db3d04881103a3b0d0 of 27 / 4 / 2012 changed can_castle() signatures from bool to int and this broke the code that calculates polyglot hash key in book.cpp Instead of directly fixing the code we prefer to change castling rights definitions to align to the polyglot ones (as we did in previous patch). After this step we can simply take internal castle rights as they are and use them directly to calculate polyglot book hash key, as we do in this patch that fixes the regression. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/book.cpp b/src/book.cpp index cc557e48..0fff6827 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -323,8 +323,7 @@ namespace { key ^= ZobPiece[PieceOffset[pos.piece_on(s)] + s]; } - b = (pos.can_castle(WHITE_OO) << 0) | (pos.can_castle(WHITE_OOO) << 1) - | (pos.can_castle(BLACK_OO) << 2) | (pos.can_castle(BLACK_OOO) << 3); + b = pos.can_castle(ALL_CASTLES); while (b) key ^= ZobCastle[pop_1st_bit(&b)];