From c40d4e0133d003f6caec8fd3bb0bab21f9298721 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Tue, 11 Mar 2014 22:58:08 +0100 Subject: [PATCH 1/1] Small simplification in gives_check Use switch statement also for normal case. No speed regression. No functional change. --- src/position.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 3fc568ee..1cb64934 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -596,12 +596,11 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const { && !aligned(from, to, ci.ksq)) return true; - // Can we skip the ugly special cases? - if (type_of(m) == NORMAL) - return false; - switch (type_of(m)) { + case NORMAL: + return false; + case PROMOTION: return attacks_bb(Piece(promotion_type(m)), to, pieces() ^ from) & ci.ksq; -- 2.39.2