X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=19f21de22f21ee12f077538f4a812f46ef40a64c;hp=2979c104aac3020c3798996597b182174b03ad4b;hb=2416242c966bfccd5a779e037dfe0d2d4cd8f3fe;hpb=14cf27e6f65787a1f9c8e4759ae0fcc218f37d2d diff --git a/src/tt.cpp b/src/tt.cpp index 2979c104..19f21de2 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -63,12 +63,12 @@ void TranspositionTable::clear() { } -/// TranspositionTable::probe() looks up the current position in the -/// transposition table. It returns true and a pointer to the TTEntry if -/// the position is found. Otherwise, it returns false and a pointer to an empty or -/// least valuable TTEntry to be replaced later. A TTEntry t1 is considered -/// to be more valuable than a TTEntry t2 if t1 is from the current search and t2 -/// is from a previous search, or if the depth of t1 is bigger than the depth of t2. +/// TranspositionTable::probe() looks up the current position in the transposition +/// table. It returns true and a pointer to the TTEntry if the position is found. +/// Otherwise, it returns false and a pointer to an empty or least valuable TTEntry +/// to be replaced later. A TTEntry t1 is considered to be more valuable than a +/// TTEntry t2 if t1 is from the current search and t2 is from a previous search, +/// or if the depth of t1 is bigger than the depth of t2. TTEntry* TranspositionTable::probe(const Key key, bool& found) const { @@ -79,20 +79,18 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { if (!tte[i].key16 || tte[i].key16 == key16) { if (tte[i].key16) - tte[i].genBound8 = uint8_t(generation | tte[i].bound()); // Refresh + tte[i].genBound8 = uint8_t(generation8 | tte[i].bound()); // Refresh - found = (bool)tte[i].key16; - return &tte[i]; + return found = (bool)tte[i].key16, &tte[i]; } // Find an entry to be replaced according to the replacement strategy TTEntry* replace = tte; for (unsigned i = 1; i < TTClusterSize; ++i) - if ( (( tte[i].genBound8 & 0xFC) == generation || tte[i].bound() == BOUND_EXACT) - - ((replace->genBound8 & 0xFC) == generation) + if ( (( tte[i].genBound8 & 0xFC) == generation8 || tte[i].bound() == BOUND_EXACT) + - ((replace->genBound8 & 0xFC) == generation8) - (tte[i].depth8 < replace->depth8) < 0) replace = &tte[i]; - found = false; - return replace; + return found = false, replace; }