projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
89ec69b
)
Speed up attackers_to
author
Fabian Fichter
<ianfab@users.noreply.github.com>
Tue, 28 Aug 2018 18:19:27 +0000 (20:19 +0200)
committer
Fabian Fichter
<ianfab@users.noreply.github.com>
Tue, 28 Aug 2018 18:19:27 +0000 (20:19 +0200)
Loop only over relevant piece types for a speed-up with no functional change.
src/position.cpp
patch
|
blob
|
history
diff --git
a/src/position.cpp
b/src/position.cpp
index
c2b40da
..
9cc14b8
100644
(file)
--- a/
src/position.cpp
+++ b/
src/position.cpp
@@
-658,7
+658,7
@@
Bitboard Position::attackers_to(Square s, Bitboard occupied) const {
Bitboard b = 0;
for (Color c = WHITE; c <= BLACK; ++c)
- for (PieceType pt = PAWN; pt <= KING; ++pt)
+ for (PieceType pt : piece_types())
b |= attacks_bb(~c, pt, s, occupied) & pieces(c, pt);
return b;
}