]> git.sesse.net Git - stockfish/commitdiff
Prefer empty() to size()
authorMarco Costalba <mcostalba@gmail.com>
Tue, 6 Dec 2011 13:18:04 +0000 (14:18 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 6 Dec 2011 18:41:48 +0000 (19:41 +0100)
As Heinz says:

"Function empty() should have a constant run-time even
 on lousy compilers and you spare the not.

The change is even measurable: + 100-150 nodes/sec. Wow:-)"

Patch from Heinz van Saanen

No functional change.

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

index 77acd89e39b12310d5333708de19c5c85c7a883f..3cae0e3fa2095c10ab08378cb142a3be37cc68cf 100644 (file)
@@ -507,7 +507,7 @@ namespace {
     Rml.init(pos, rootMoves);
 
     // Handle special case of searching on a mate/stalemate position
     Rml.init(pos, rootMoves);
 
     // Handle special case of searching on a mate/stalemate position
-    if (!Rml.size())
+    if (Rml.empty())
     {
         cout << "info" << depth_to_uci(DEPTH_ZERO)
              << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW, alpha, beta) << endl;
     {
         cout << "info" << depth_to_uci(DEPTH_ZERO)
              << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW, alpha, beta) << endl;