mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Use pointers instead of array indices in MovePicker
This avoids calculating the array entry position at each access and gives another boost of almost 1%. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
10
src/book.cpp
10
src/book.cpp
@@ -429,11 +429,11 @@ Move Book::get_move(const Position& pos) {
|
||||
if (!bookMove)
|
||||
return MOVE_NONE;
|
||||
|
||||
MoveStack moves[256];
|
||||
int n = generate_legal_moves(pos, moves);
|
||||
for (int j = 0; j < n; j++)
|
||||
if ((int(moves[j].move) & 07777) == bookMove)
|
||||
return moves[j].move;
|
||||
MoveStack mlist[256];
|
||||
MoveStack* last = generate_legal_moves(pos, mlist);
|
||||
for (MoveStack* cur = mlist; cur != last; cur++)
|
||||
if ((int(cur->move) & 07777) == bookMove)
|
||||
return cur->move;
|
||||
|
||||
return MOVE_NONE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user