1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

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.
This commit is contained in:
Marco Costalba 2012-11-01 09:30:03 +01:00
parent e3b0327812
commit 94ecdef8ac

View file

@ -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;
}