X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.h;h=c570761bdec0fd91120fe99a28b1b18f562c7bcc;hp=76ecad81e101254dea4832984f2022dd9e2055da;hb=6d117e4a23dd1a3a22d5553b4ac15d9d15f0aafe;hpb=659c54582ddb1bbbf80f7022a80c027ab0bd4c42 diff --git a/src/tt.h b/src/tt.h index 76ecad81..c570761b 100644 --- a/src/tt.h +++ b/src/tt.h @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008 Marco Costalba + Copyright (C) 2008-2009 Marco Costalba Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,8 +53,11 @@ class TTEntry { public: - TTEntry(); - TTEntry(Key k, Value v, ValueType t, Depth d, Move m, int generation); + TTEntry() {} + TTEntry(Key k, Value v, ValueType t, Depth d, Move m, int generation) + : key_ (k), data((m & 0x1FFFF) | (t << 20) | (generation << 23)), + value_(int16_t(v)), depth_(int16_t(d)) {} + Key key() const { return key_; } Depth depth() const { return Depth(depth_); } Move move() const { return Move(data & 0x1FFFF); } @@ -76,32 +79,22 @@ private: class TranspositionTable { public: - TranspositionTable(unsigned mbSize); + TranspositionTable(); ~TranspositionTable(); void set_size(unsigned mbSize); void clear(); - void store(const Position &pos, Value v, Depth d, Move m, ValueType type); - TTEntry* retrieve(const Position &pos) const; + void store(const Key posKey, Value v, ValueType type, Depth d, Move m); + TTEntry* retrieve(const Key posKey) const; void new_search(); - void insert_pv(const Position &pos, Move pv[]); - int full(); + void insert_pv(const Position& pos, Move pv[]); + int full() const; private: - inline TTEntry* first_entry(const Position &pos) const; + inline TTEntry* first_entry(const Key posKey) const; - unsigned size; - int writes; + unsigned size, writes; TTEntry* entries; uint8_t generation; }; - -//// -//// Constants and variables -//// - -// Default transposition table size, in megabytes: -const int TTDefaultSize = 32; - - #endif // !defined(TT_H_INCLUDED)