Update piece list iteration also in evaluate_pieces()
authorMarco Costalba <mcostalba@gmail.com>
Sat, 26 Sep 2009 05:14:12 +0000 (07:14 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 26 Sep 2009 13:49:04 +0000 (15:49 +0200)
Move to what we already do in generate_piece_moves()

This simple patch gives a spped up of 1.4% !!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/evaluate.cpp

index 85665a4344de241382f68210b31041eeee1d01fb..6eec5d23b57cfe0b8ae6fb309e3b118f948c8fd3 100644 (file)
@@ -614,11 +614,10 @@ namespace {
     int mob;
     File f;
     Color them = opposite_color(us);
+    const Square* ptr = pos.piece_list_begin(us, Piece);
 
-    for (int i = 0, e = pos.piece_count(us, Piece); i < e; i++)
+    while ((s = *ptr++) != SQ_NONE)
     {
-        s = pos.piece_list(us, Piece, i);
-
         if (Piece == KNIGHT || Piece == QUEEN)
             b = pos.attacks_from<Piece>(s);
         else if (Piece == BISHOP)