]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Remove popcount trick from space evaluation
[stockfish] / src / evaluate.cpp
index 0ee89e4d8236999815797272c92efe1c772c4c5e..2b901bbd166777ad311a2a691bf69538084c48fb 100644 (file)
@@ -726,12 +726,9 @@ namespace {
     behind |= (Us == WHITE ? behind >>  8 : behind <<  8);
     behind |= (Us == WHITE ? behind >> 16 : behind << 16);
 
     behind |= (Us == WHITE ? behind >>  8 : behind <<  8);
     behind |= (Us == WHITE ? behind >> 16 : behind << 16);
 
-    // Since SpaceMask[Us] is fully on our half of the board...
-    assert(unsigned(safe >> (Us == WHITE ? 32 : 0)) == 0);
-
-    // ...count safe + (behind & safe) with a single popcount.
-    int bonus = popcount((Us == WHITE ? safe << 32 : safe >> 32) | (behind & safe));
+    int bonus = popcount(safe) + popcount(behind & safe);
     int weight = pos.count<ALL_PIECES>(Us) - 2 * pe->open_files();
     int weight = pos.count<ALL_PIECES>(Us) - 2 * pe->open_files();
+
     Score score = make_score(bonus * weight * weight / 16, 0);
 
     if (T)
     Score score = make_score(bonus * weight * weight / 16, 0);
 
     if (T)