]> git.sesse.net Git - stockfish/commitdiff
Drop KILLER_MAX. Hardcode to 2 instead.
authorJoona Kiiski <joona.kiiski@gmail.com>
Sun, 18 Jul 2010 20:52:03 +0000 (23:52 +0300)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 19 Jul 2010 02:51:25 +0000 (03:51 +0100)
KILLER_MAX in search.h is quite pointless, because
we already hardcode this to 2 in MovePicker anyway.

By hard-coding this to 2 we can keep code simpler.

No functional change

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

index 0f5e6907b5f173de954483812068d4d6b70f08ca..7aab835d93d36a7b7eba9db7479ca5a1716cd3af 100644 (file)
@@ -368,9 +368,7 @@ void SearchStack::init() {
 // SearchStack::initKillers() initializes killers for a search stack entry
 void SearchStack::initKillers() {
 
-  mateKiller = MOVE_NONE;
-  for (int i = 0; i < KILLER_MAX; i++)
-      killers[i] = MOVE_NONE;
+  killers[0] = killers[1] = mateKiller = MOVE_NONE;
 }
 
 
@@ -1872,10 +1870,8 @@ namespace {
 
   bool move_is_killer(Move m, SearchStack* ss) {
 
-      const Move* k = ss->killers;
-      for (int i = 0; i < KILLER_MAX; i++, k++)
-          if (*k == m)
-              return true;
+      if (ss->killers[0] == m || ss->killers[1] == m)
+          return true;
 
       return false;
   }
@@ -2052,9 +2048,7 @@ namespace {
     if (m == ss->killers[0])
         return;
 
-    for (int i = KILLER_MAX - 1; i > 0; i--)
-        ss->killers[i] = ss->killers[i - 1];
-
+    ss->killers[1] = ss->killers[0];
     ss->killers[0] = m;
   }
 
index 61a33242124f3f68515d4d87a9907af9a5c49a64..74951548df0c6ec5d08e1298dfb174fd467bee3e 100644 (file)
@@ -36,7 +36,6 @@
 
 const int PLY_MAX = 100;
 const int PLY_MAX_PLUS_2 = 102;
-const int KILLER_MAX = 2;
 
 
 ////
@@ -55,7 +54,7 @@ struct SearchStack {
   Move threatMove;
   Move excludedMove;
   Move bestMove;
-  Move killers[KILLER_MAX];
+  Move killers[2];
   Depth reduction;
   Value eval;
   bool skipNullMove;