-extern TranspositionTable TT;
-
-
-/// TranspositionTable::first_entry() returns a pointer to the first entry of
-/// a cluster given a position. The lowest order bits of the key are used to
-/// get the index of the cluster.
-
-inline TTEntry* TranspositionTable::first_entry(const Key posKey) const {
-
- return entries[((uint32_t)posKey) & (size - 1)].data;
-}
-
-
-/// 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 hash table used to store pawns and material configurations. It is
-/// basically just an array of Entry objects. Without cluster concept, overwrite
-/// policy nor resizing.
-
-template<class Entry, int HashSize>
-struct HashTable {
-
- typedef HashTable<Entry, HashSize> Base;
-
- HashTable() {
-
- entries = new (std::nothrow) Entry[HashSize];
- if (!entries)
- {
- std::cerr << "Failed to allocate " << HashSize * sizeof(Entry)
- << " bytes for hash table." << std::endl;
- ::exit(EXIT_FAILURE);
- }
- memset(entries, 0, HashSize * sizeof(Entry));
+ // The 32 lowest order bits of the key are used to get the index of the cluster
+ TTEntry* first_entry(const Key key) const {
+ return &table[(uint32_t(key) * uint64_t(clusterCount)) >> 32].entry[0];