]> git.sesse.net Git - stockfish/commitdiff
Simplify chain detection
authorhomoSapiensSapiens <reuvenpe2005@gmail.com>
Sun, 25 Aug 2013 14:59:47 +0000 (17:59 +0300)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 25 Aug 2013 16:36:49 +0000 (18:36 +0200)
No functional change.

src/pawns.cpp

index 747781a3308f8e6ed6938c1b6bfbdf31af250c5f..772410a04b9e7c4c63a79e6c33f39bdf7566298e 100644 (file)
@@ -92,7 +92,6 @@ namespace {
     Bitboard b;
     Square s;
     File f;
-    Rank r;
     bool passed, isolated, doubled, opposed, chain, backward, candidate;
     Score value = SCORE_ZERO;
     const Square* pl = pos.list<PAWN>(Us);
@@ -113,13 +112,12 @@ namespace {
         assert(pos.piece_on(s) == make_piece(Us, PAWN));
 
         f = file_of(s);
-        r = rank_of(s);
 
         // This file cannot be semi-open
         e->semiopenFiles[Us] &= ~(1 << f);
 
         // Our rank plus previous one. Used for chain detection
-        b = rank_bb(r) | rank_bb(Us == WHITE ? r - Rank(1) : r + Rank(1));
+        b = rank_bb(s) | rank_bb(s - pawn_push(Us));
 
         // Flag the pawn as passed, isolated, doubled or member of a pawn
         // chain (but not the backward one).