mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Split branches in generate_piece_moves()
Instead of one comparison in while() condition use two, the first to check if the piece is exsistant and the second to loop across pieces of that type. This should help branch prediction in cases we have only one piece of the same type, for instance for queens, the first branch is always true and the second is almost always false. Increased speed of 0.3-0.5 % on Gcc pgo compiles. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
2a2353aac6
commit
d9dc9dbd65
1 changed files with 6 additions and 3 deletions
|
@ -429,10 +429,13 @@ namespace {
|
|||
Square from;
|
||||
const Square* ptr = pos.piece_list_begin(us, Piece);
|
||||
|
||||
while ((from = *ptr++) != SQ_NONE)
|
||||
if (*ptr != SQ_NONE)
|
||||
{
|
||||
do {
|
||||
from = *ptr;
|
||||
b = pos.attacks_from<Piece>(from) & target;
|
||||
SERIALIZE_MOVES(b);
|
||||
} while (*++ptr != SQ_NONE);
|
||||
}
|
||||
return mlist;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue