]> git.sesse.net Git - stockfish/blobdiff - src/bitbase.cpp
Don't log search info after a stop
[stockfish] / src / bitbase.cpp
index 96ada8dd59d2ac95e6dd6ab2d7d8826db0022354..c06ca521391fdf466db8b9f68ebe2687a3be1164 100644 (file)
@@ -1,7 +1,7 @@
 /*
   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
   Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
-  Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
+  Copyright (C) 2008-2012 Marco Costalba, Joona Kiiski, Tord Romstad
 
   Stockfish is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -39,9 +39,9 @@ namespace {
     void from_index(int index);
     Result classify_white(const Result db[]);
     Result classify_black(const Result db[]);
-    Bitboard wk_attacks()   const { return StepAttacksBB[WK][whiteKingSquare]; }
-    Bitboard bk_attacks()   const { return StepAttacksBB[BK][blackKingSquare]; }
-    Bitboard pawn_attacks() const { return StepAttacksBB[WP][pawnSquare]; }
+    Bitboard wk_attacks()   const { return StepAttacksBB[W_KING][whiteKingSquare]; }
+    Bitboard bk_attacks()   const { return StepAttacksBB[B_KING][blackKingSquare]; }
+    Bitboard pawn_attacks() const { return StepAttacksBB[W_PAWN][pawnSquare]; }
 
     Square whiteKingSquare, blackKingSquare, pawnSquare;
     Color sideToMove;
@@ -134,8 +134,8 @@ namespace {
         return RESULT_INVALID;
 
     // Check if a king can be captured
-    if (    bit_is_set(wk_attacks(), blackKingSquare)
-        || (bit_is_set(pawn_attacks(), blackKingSquare) && sideToMove == WHITE))
+    if (   (wk_attacks() & blackKingSquare)
+        || ((pawn_attacks() & blackKingSquare) && sideToMove == WHITE))
         return RESULT_INVALID;
 
     // The position is an immediate win if it is white to move and the
@@ -144,19 +144,19 @@ namespace {
         && sideToMove == WHITE
         && whiteKingSquare != pawnSquare + DELTA_N
         && (   square_distance(blackKingSquare, pawnSquare + DELTA_N) > 1
-            || bit_is_set(wk_attacks(), pawnSquare + DELTA_N)))
+            || (wk_attacks() & (pawnSquare + DELTA_N))))
         return RESULT_WIN;
 
     // Check for known draw positions
     //
     // Case 1: Stalemate
     if (   sideToMove == BLACK
-        && (bk_attacks() & ~(wk_attacks() | pawn_attacks())) == EmptyBoardBB)
+        && !(bk_attacks() & ~(wk_attacks() | pawn_attacks())))
         return RESULT_DRAW;
 
     // Case 2: King can capture pawn
     if (   sideToMove == BLACK
-        && bit_is_set(bk_attacks(), pawnSquare) && !bit_is_set(wk_attacks(), pawnSquare))
+        && (bk_attacks() & pawnSquare) && !(wk_attacks() & pawnSquare))
         return RESULT_DRAW;
 
     // Case 3: Black king in front of white pawn