X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsearch.cpp;h=95f1332ed1ddb6e1ca743e006cdf1039bcd034d8;hb=d48a304262eb6b96864df11734976b4a57fcc72a;hp=6d900f7bb7ae673575f2d52b953ed63ca2c2d3ff;hpb=0a1092f64eb9eb232094036086fc5c98ed1f3c46;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 6d900f7b..95f1332e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -51,6 +51,12 @@ using std::string; using Eval::evaluate; using namespace Search; +// Fast wrapper for common case of pos.gives_check() +#define FAST_GIVES_CHECK(pos, m, ci) \ + ((type_of(m) == NORMAL && ci.dcCandidates == 0) \ + ? (ci.checkSq[type_of(pos.piece_on(from_sq(m)))] & to_sq(m)) \ + : pos.gives_check(m, ci)) + namespace { // Set to true to force running with one thread. Used for debugging @@ -754,7 +760,7 @@ moves_loop: // When in check and at SpNode search starts from here ext = DEPTH_ZERO; captureOrPromotion = pos.capture_or_promotion(move); - givesCheck = pos.gives_check(move, ci); + givesCheck = FAST_GIVES_CHECK(pos, move, ci); dangerous = givesCheck || type_of(move) != NORMAL || pos.advanced_pawn_push(move); @@ -1134,7 +1140,7 @@ moves_loop: // When in check and at SpNode search starts from here { assert(is_ok(move)); - givesCheck = pos.gives_check(move, ci); + givesCheck = FAST_GIVES_CHECK(pos, move, ci); // Futility pruning if ( !PvNode