]> git.sesse.net Git - stockfish/commitdiff
Simplify TT replace strategy
authorMarco Costalba <mcostalba@gmail.com>
Sun, 23 Mar 2014 09:03:11 +0000 (10:03 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 24 Mar 2014 07:32:08 +0000 (08:32 +0100)
Tested for no-regression with SPRT[-3, 1] at STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 32046 W: 6020 L: 5918 D: 20108

No functional change.

src/tt.cpp

index 41fc33ff9ebba868927ce1de876ab42f512b2618..d887844caf12eccae99b84c63ffc9d15a193ef48 100644 (file)
@@ -94,7 +94,6 @@ const TTEntry* TranspositionTable::probe(const Key key) const {
 
 void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m, Value statV) {
 
 
 void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m, Value statV) {
 
-  int c1, c2, c3;
   TTEntry *tte, *replace;
   uint32_t key32 = key >> 32; // Use the high 32 bits as key inside the cluster
 
   TTEntry *tte, *replace;
   uint32_t key32 = key >> 32; // Use the high 32 bits as key inside the cluster
 
@@ -112,11 +111,9 @@ void TranspositionTable::store(const Key key, Value v, Bound b, Depth d, Move m,
       }
 
       // Implement replace strategy
       }
 
       // Implement replace strategy
-      c1 = (replace->generation8 == generation ?  2 : 0);
-      c2 = (tte->generation8 == generation || tte->bound() == BOUND_EXACT ? -2 : 0);
-      c3 = (tte->depth16 < replace->depth16 ?  1 : 0);
-
-      if (c1 + c2 + c3 > 0)
+      if (  (replace->generation8 == generation) * 2
+          - (tte->generation8 == generation || tte->bound() == BOUND_EXACT) * 2
+          + (tte->depth16 < replace->depth16) > 0)
           replace = tte;
   }
 
           replace = tte;
   }