From: Reuven Peleg Date: Mon, 17 Jun 2013 10:49:11 +0000 (+0300) Subject: Remove confusing optimization X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e05c80a08859f6c4f0f599ca0b262ced00ad66fe;hp=7b31e81d77b636a635b327de91414a0585fedb2a Remove confusing optimization Here we skip the call to pos.attacks_from(s) in the 98% of cases, testing the first 2 members first. Unfortunatly code is a bit triky and not clear. So we give up to the speed optimization in exchange of more code clarity. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index a19f346d..ea37bbeb 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -821,8 +821,7 @@ Value do_evaluate(const Position& pos, Value& margin) { // If there is an enemy rook or queen attacking the pawn from behind, // add all X-ray attacks by the rook or queen. Otherwise consider only // the squares in the pawn's path attacked or occupied by the enemy. - if ( (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN)) - && (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from(s))) + if (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from(s)) unsafeSquares = squaresToQueen; else unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));