]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Speed up max_piece_type()
[stockfish] / src / evaluate.cpp
index ad420fbdae4917ba01070f5f2b7ae98991e263ed..d5a4bb970a954e78379c6917f1752bf8eb4bce43 100644 (file)
@@ -27,7 +27,7 @@
 #include "material.h"
 #include "pawns.h"
 #include "thread.h"
 #include "material.h"
 #include "pawns.h"
 #include "thread.h"
-#include "ucioption.h"
+#include "uci.h"
 
 namespace {
 
 
 namespace {
 
@@ -500,7 +500,10 @@ namespace {
     assert(target & (pos.pieces(C) ^ pos.pieces(C, KING)));
 
     PieceType pt;
     assert(target & (pos.pieces(C) ^ pos.pieces(C, KING)));
 
     PieceType pt;
-    for (pt = QUEEN; !(target & pos.pieces(C, pt)); --pt) {}
+    for (pt = QUEEN; pt >= KNIGHT; --pt)
+        if (target & pos.pieces(C, pt))
+            break;
+
     return pt;
   }
 
     return pt;
   }