From: protonspring Date: Tue, 3 Mar 2020 23:35:45 +0000 (-0700) Subject: Small speed-up in BetweenBB X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=0424273d0b20ae7ad65143b530b2db8b94de0338 Small speed-up in BetweenBB A speed-up removing some comparisons. closes https://github.com/official-stockfish/Stockfish/pull/2571 No functional change. --- diff --git a/src/bitboard.h b/src/bitboard.h index ca161481..b0e27233 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -199,8 +199,8 @@ inline Bitboard adjacent_files_bb(Square s) { /// If the given squares are not on a same file/rank/diagonal, return 0. inline Bitboard between_bb(Square s1, Square s2) { - return LineBB[s1][s2] & ( (AllSquares << (s1 + (s1 < s2))) - ^(AllSquares << (s2 + !(s1 < s2)))); + Bitboard b = LineBB[s1][s2] & ((AllSquares << s1) ^ (AllSquares << s2)); + return b & (b - 1); //exclude lsb }