-
-/// TranspositionTable::refresh() updates the 'generation' value of the TTEntry
-/// to avoid aging. Normally called after a TT hit.
-
-inline void TranspositionTable::refresh(const TTEntry* tte) const {
-
- const_cast<TTEntry*>(tte)->set_generation(generation);
-}
-
-
-/// A simple fixed size hash table used to store pawns and material
-/// configurations. It is basically just an array of Entry objects.
-/// Without cluster concept or overwrite policy.
-
-template<class Entry, int HashSize>
-struct SimpleHash {
-
- typedef SimpleHash<Entry, HashSize> Base;
-
- void init() {
-
- entries = new (std::nothrow) Entry[HashSize];
- if (!entries)
- {
- std::cerr << "Failed to allocate " << HashSize * sizeof(Entry)
- << " bytes for material hash table." << std::endl;
- exit(EXIT_FAILURE);
- }
- memset(entries, 0, HashSize * sizeof(Entry));
- }
-
- 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)); }
-
-protected:
- Entry* entries;
-};
-
-#endif // !defined(TT_H_INCLUDED)