]> git.sesse.net Git - stockfish/commitdiff
Use probe() as name for looking up into an hash table
authorMarco Costalba <mcostalba@gmail.com>
Tue, 26 Apr 2011 12:10:02 +0000 (14:10 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 27 Apr 2011 06:31:51 +0000 (07:31 +0100)
No functional change.

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

index add0f32bc29509844997880cc2ffdd3aa9c67cf9..19a334baa25727e35ee2f198b3e72d93e14b7267 100644 (file)
@@ -98,7 +98,7 @@ MaterialInfoTable::~MaterialInfoTable() { delete funcs; }
 MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) const {
 
   Key key = pos.get_material_key();
-  MaterialInfo* mi = find(key);
+  MaterialInfo* mi = probe(key);
 
   // If mi->key matches the position's material hash key, it means that we
   // have analysed this material configuration before, and we can simply
index 59c05c73276798011cb528bad093adff89d7deff..587c9b95509224a4f396ae27ec50cf2a3aac6f50 100644 (file)
@@ -75,7 +75,7 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) const {
   assert(pos.is_ok());
 
   Key key = pos.get_pawn_key();
-  PawnInfo* pi = find(key);
+  PawnInfo* pi = probe(key);
 
   // If pi->key matches the position's pawn hash key, it means that we
   // have analysed this pawn structure before, and we can simply return
index 0318d63138ea41dd9913808c221e2540d617f8b0..eb7666afd5142b85c624fabaeeba71b7dce04b77 100644 (file)
@@ -736,7 +736,7 @@ namespace {
     excludedMove = ss->excludedMove;
     posKey = excludedMove ? pos.get_exclusion_key() : pos.get_key();
 
-    tte = TT.retrieve(posKey);
+    tte = TT.probe(posKey);
     ttMove = tte ? tte->move() : MOVE_NONE;
 
     // At PV nodes we check for exact scores, while at non-PV nodes we check for
@@ -872,7 +872,7 @@ namespace {
         ss->skipNullMove = false;
 
         ttMove = ss->bestMove;
-        tte = TT.retrieve(posKey);
+        tte = TT.probe(posKey);
     }
 
 split_point_start: // At split points actual search starts from here
@@ -1277,7 +1277,7 @@ split_point_start: // At split points actual search starts from here
 
     // Transposition table lookup. At PV nodes, we don't use the TT for
     // pruning, but only for move ordering.
-    tte = TT.retrieve(pos.get_key());
+    tte = TT.probe(pos.get_key());
     ttMove = (tte ? tte->move() : MOVE_NONE);
 
     if (!PvNode && tte && ok_to_use_TT(tte, ttDepth, beta, ss->ply))
@@ -1987,7 +1987,7 @@ split_point_start: // At split points actual search starts from here
 
     pos.do_move(pv[0], *st++);
 
-    while (   (tte = TT.retrieve(pos.get_key())) != NULL
+    while (   (tte = TT.probe(pos.get_key())) != NULL
            && tte->move() != MOVE_NONE
            && pos.move_is_legal(tte->move())
            && ply < PLY_MAX
@@ -2017,7 +2017,7 @@ split_point_start: // At split points actual search starts from here
 
     do {
         k = pos.get_key();
-        tte = TT.retrieve(k);
+        tte = TT.probe(k);
 
         // Don't overwrite existing correct entries
         if (!tte || tte->move() != pv[ply])
index d18b512cd429f8a161c583de962e1a68ef4964b3..14217e8db2cafd0fc925143fc04795090136619a 100644 (file)
@@ -117,11 +117,11 @@ void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d,
 }
 
 
-/// TranspositionTable::retrieve() looks up the current position in the
+/// TranspositionTable::probe() looks up the current position in the
 /// transposition table. Returns a pointer to the TTEntry or NULL if
 /// position is not found.
 
-TTEntry* TranspositionTable::retrieve(const Key posKey) const {
+TTEntry* TranspositionTable::probe(const Key posKey) const {
 
   uint32_t posKey32 = posKey >> 32;
   TTEntry* tte = first_entry(posKey);
index 69cdad0c17dc19f19d351a36e0b79faf5e696700..03147bf1a8f5aadb8deb0162902b023d0c574c32 100644 (file)
--- a/src/tt.h
+++ b/src/tt.h
@@ -104,7 +104,7 @@ public:
   void set_size(size_t mbSize);
   void clear();
   void store(const Key posKey, Value v, ValueType type, Depth d, Move m, Value statV, Value kingD);
-  TTEntry* retrieve(const Key posKey) const;
+  TTEntry* probe(const Key posKey) const;
   void new_search();
   TTEntry* first_entry(const Key posKey) const;
   void refresh(const TTEntry* tte) const;
@@ -163,8 +163,8 @@ struct SimpleHash {
 
   virtual ~SimpleHash() { delete [] entries; }
 
-  Entry* find(Key key) const { return entries + ((uint32_t)key & (HashSize - 1)); }
-  void prefetch(Key key) const { ::prefetch((char*)find(key)); }
+  Entry* probe(Key key) const { return entries + ((uint32_t)key & (HashSize - 1)); }
+  void prefetch(Key key) const { ::prefetch((char*)probe(key)); }
 
 protected:
   Entry* entries;
index 5a302a8d1b9d44286a39be48aeb25bcd69607ec0..39270c6ff93697b1ff3206f4022637be613fecad 100644 (file)
@@ -182,8 +182,7 @@ namespace {
 
     string token;
     SearchLimits limits;
-    Move searchMoves[MAX_MOVES] = { MOVE_NONE };
-    Move* cur = searchMoves;
+    Move searchMoves[MAX_MOVES], *cur = searchMoves;
     int time[] = { 0, 0 }, inc[] = { 0, 0 };
 
     while (up >> token)
@@ -209,19 +208,16 @@ namespace {
         else if (token == "movetime")
             up >> limits.maxTime;
         else if (token == "searchmoves")
-        {
             while (up >> token)
                 *cur++ = move_from_uci(pos, token);
-
-            *cur = MOVE_NONE;
-        }
     }
 
-    assert(pos.is_ok());
-
+    *cur = MOVE_NONE;
     limits.time = time[pos.side_to_move()];
     limits.increment = inc[pos.side_to_move()];
 
+    assert(pos.is_ok());
+
     return think(pos, limits, searchMoves);
   }