X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpawns.cpp;h=c9c9e5992dbaf83cca00876317e3c3d9456647a1;hb=c8589903777b6e0289640b43fae966ded442af48;hp=edd670b84cc4ec3021fdcd2b3962bbd419cfdc88;hpb=e917bd59b1e317c6b48dc676473359fdfb86d9d4;p=stockfish
diff --git a/src/pawns.cpp b/src/pawns.cpp
index edd670b8..c9c9e599 100644
--- a/src/pawns.cpp
+++ b/src/pawns.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "bitboard.h"
@@ -96,7 +95,7 @@ namespace {
// Flag the pawn
opposed = theirPawns & forward_file_bb(Us, s);
- stoppers = theirPawns & passed_pawn_mask(Us, s);
+ stoppers = theirPawns & passed_pawn_span(Us, s);
lever = theirPawns & PawnAttacks[Us][s];
leverPush = theirPawns & PawnAttacks[Us][s + Up];
doubled = ourPawns & (s - Up);
@@ -114,11 +113,11 @@ namespace {
// which could become passed after one or two pawn pushes when are
// not attacked more times than defended.
if ( !(stoppers ^ lever ^ leverPush)
- && popcount(support) >= popcount(lever) - 1
- && popcount(phalanx) >= popcount(leverPush))
+ && (support || !more_than_one(lever))
+ && popcount(phalanx) >= popcount(leverPush))
e->passedPawns[Us] |= s;
- else if ( stoppers == SquareBB[s + Up]
+ else if ( stoppers == square_bb(s + Up)
&& relative_rank(Us, s) >= RANK_5)
{
b = shift(support) & ~theirPawns;
@@ -185,9 +184,7 @@ Entry* probe(const Position& pos) {
e->key = key;
e->scores[WHITE] = evaluate(pos, e);
e->scores[BLACK] = evaluate(pos, e);
- e->openFiles = popcount(e->semiopenFiles[WHITE] & e->semiopenFiles[BLACK]);
- e->asymmetry = popcount( (e->passedPawns[WHITE] | e->passedPawns[BLACK])
- | (e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK]));
+ e->passedCount= popcount(e->passedPawns[WHITE] | e->passedPawns[BLACK]);
return e;
}
@@ -210,7 +207,7 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) {
Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ?
Value(374) : Value(5);
- File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq)));
+ File center = clamp(file_of(ksq), FILE_B, FILE_G);
for (File f = File(center - 1); f <= File(center + 1); ++f)
{
b = ourPawns & file_bb(f);