]> git.sesse.net Git - stockfish/commitdiff
Fix KpsK endgame
authorMarco Costalba <mcostalba@gmail.com>
Sun, 16 Sep 2012 06:52:38 +0000 (08:52 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 16 Sep 2012 06:57:26 +0000 (08:57 +0200)
Broken by commit a44c5cf4f77b05a03 of 3 /12 / 2011 that
was labeled "No functional change" because our 'bench'
test didn't triggered that particular endgame. Indeed
we need to run a specific bench on a set of endgames
position when touching endgame.cpp because normal bench
does not cover endgames properly.

Found by MSVC 2012 code analyzer.

src/endgame.cpp

index dbf10582ac8964fdf3f047d6d93c54b202274c5d..20d175bab916fe150172bb63f2cabd724499b597 100644 (file)
@@ -648,7 +648,7 @@ ScaleFactor Endgame<KPsK>::operator()(const Position& pos) const {
       // Does the defending king block the pawns?
       if (   square_distance(ksq, relative_square(strongerSide, SQ_A8)) <= 1
           || (    file_of(ksq) == FILE_A
-              && !in_front_bb(strongerSide, ksq) & pawns))
+              && !(in_front_bb(strongerSide, ksq) & pawns)))
           return SCALE_FACTOR_DRAW;
   }
   // Are all pawns on the 'h' file?
@@ -657,7 +657,7 @@ ScaleFactor Endgame<KPsK>::operator()(const Position& pos) const {
     // Does the defending king block the pawns?
     if (   square_distance(ksq, relative_square(strongerSide, SQ_H8)) <= 1
         || (    file_of(ksq) == FILE_H
-            && !in_front_bb(strongerSide, ksq) & pawns))
+            && !(in_front_bb(strongerSide, ksq) & pawns)))
         return SCALE_FACTOR_DRAW;
   }
   return SCALE_FACTOR_NONE;