From: Marco Costalba Date: Sat, 14 Jun 2014 10:16:22 +0000 (+0200) Subject: Factor out pawn attacks in 'lever' X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=3c1201c20c6adceceff764a56aa80e615ca80c64 Factor out pawn attacks in 'lever' Improves readibility and possibly speed. No functional change. --- diff --git a/src/pawns.cpp b/src/pawns.cpp index 0bc2a632..aa3139e2 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -93,7 +93,6 @@ namespace { const Square Up = (Us == WHITE ? DELTA_N : DELTA_S); const Square Right = (Us == WHITE ? DELTA_NE : DELTA_SW); const Square Left = (Us == WHITE ? DELTA_NW : DELTA_SE); - const Piece pc = make_piece(Us, PAWN); Bitboard b, p, doubled; Square s; @@ -101,6 +100,7 @@ namespace { bool passed, isolated, opposed, connected, backward, candidate, unsupported, lever; Score value = SCORE_ZERO; const Square* pl = pos.list(Us); + const Bitboard* pawnAttacksBB = StepAttacksBB[make_piece(Us, PAWN)]; Bitboard ourPawns = pos.pieces(Us, PAWN); Bitboard theirPawns = pos.pieces(Them, PAWN); @@ -136,7 +136,7 @@ namespace { doubled = ourPawns & forward_bb(Us, s); opposed = theirPawns & forward_bb(Us, s); passed = !(theirPawns & passed_pawn_mask(Us, s)); - lever = theirPawns & StepAttacksBB[pc][s]; + lever = theirPawns & pawnAttacksBB[s]; // Test for backward pawn. // If the pawn is passed, isolated, or connected it cannot be @@ -192,6 +192,9 @@ namespace { if (connected) value += Connected[f][relative_rank(Us, s)]; + if (lever) + value += Lever[relative_rank(Us, s)]; + if (candidate) { value += CandidatePassed[relative_rank(Us, s)]; @@ -199,9 +202,6 @@ namespace { if (!doubled) e->candidatePawns[Us] |= s; } - - if (lever) - value += Lever[relative_rank(Us, s)]; } // In endgame it's better to have pawns on both wings. So give a bonus according