X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=1959693258c3d8e0e6dbad995103ed0ee766cbe2;hp=268c21f896ab3c89e962ae6dde36c9001030231b;hb=a230dc14045691667ffce46619de60497edceb88;hpb=c2c0ba875f429e497c936b61be9f75dcc88385a9 diff --git a/src/tt.cpp b/src/tt.cpp index 268c21f8..19596932 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -136,29 +136,20 @@ void TranspositionTable::store(const Position &pos, Value v, Depth d, /// TranspositionTable::retrieve looks up the current position in the -/// transposition table, and extracts the value, value type, depth and -/// best move if the position is found. The return value is true if -/// the position is found, and false if it isn't. +/// transposition table. Returns a pointer to the TTEntry or NULL +/// if position is not found. + +const TTEntry* TranspositionTable::retrieve(const Position &pos) const { -bool TranspositionTable::retrieve(const Position &pos, Value *value, - Depth *d, Move *move, - ValueType *type) const { TTEntry *tte = first_entry(pos); for (int i = 0; i < 4; i++) { tte += i; if (tte->key() == pos.get_key()) - { - *value = tte->value(); - *type = tte->type(); - *d = tte->depth(); - *move = tte->move(); - return true; - } + return tte; } - *move = MOVE_NONE; - return false; + return NULL; } @@ -222,28 +213,4 @@ TTEntry::TTEntry(Key k, Value v, ValueType t, Depth d, Move m, value_(v), depth_(int16_t(d)) {} -/// Functions for extracting data from TTEntry objects. - -inline Key TTEntry::key() const { - return key_; -} - -inline Depth TTEntry::depth() const { - return Depth(depth_); -} - -inline Move TTEntry::move() const { - return Move(data & 0x7FFFF); -} - -inline Value TTEntry::value() const { - return Value(value_); -} - -inline ValueType TTEntry::type() const { - return ValueType((data >> 20) & 3); -} -inline int TTEntry::generation() const { - return (data >> 23); -}