From: Marco Costalba Date: Thu, 1 Nov 2012 08:30:03 +0000 (+0100) Subject: Micro-optimize pop_lsb() for 64bit case X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=94ecdef8ac7855e7a44efd7890c7e8f8d5819397;ds=sidebyside Micro-optimize pop_lsb() for 64bit case On Intel, perhaps due to 'lea' instruction this way of zeroing the lsb of *b seems faster than a shift+negate. On perft (where any speed difference is magnified) I got a 6% speed up on my Intel i5 64bit. Suggested by Hongzhi Cheng. No functional change. --- diff --git a/src/bitboard.h b/src/bitboard.h index b99cc259..35904377 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -280,7 +280,7 @@ FORCE_INLINE Square msb(Bitboard b) { FORCE_INLINE Square pop_lsb(Bitboard* b) { const Square s = lsb(*b); - *b &= ~(1ULL << s); + *b &= *b - 1; return s; }