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:
Marco Costalba
2009-08-28 08:57:52 +02:00
parent 6cf28d4aa7
commit 9e4befe3f1
7 changed files with 106 additions and 109 deletions

View File

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