projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
e3b0327
)
Micro-optimize pop_lsb() for 64bit case
author
Marco Costalba
<mcostalba@gmail.com>
Thu, 1 Nov 2012 08:30:03 +0000 (09:30 +0100)
committer
Marco Costalba
<mcostalba@gmail.com>
Fri, 2 Nov 2012 11:11:49 +0000 (12:11 +0100)
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.
src/bitboard.h
patch
|
blob
|
history
diff --git
a/src/bitboard.h
b/src/bitboard.h
index
b99cc25
..
3590437
100644
(file)
--- 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;
}