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
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);
{
assert(is_ok(move));
- givesCheck = pos.gives_check(move, ci);
+ givesCheck = FAST_GIVES_CHECK(pos, move, ci);
// Futility pruning
if ( !PvNode