X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.h;fp=src%2Ftt.h;h=3e1d0e998274cc6e8f96d2b9ca364350fb330b99;hp=76db03dabafd744cb813b82654e3da4a3c129219;hb=1ea488d34c0b6a03fa3d89d289fe72fd1408cafd;hpb=995ee4b31105ad8c7976cc68c11fabfdc5108e63 diff --git a/src/tt.h b/src/tt.h index 76db03da..3e1d0e99 100644 --- a/src/tt.h +++ b/src/tt.h @@ -66,7 +66,6 @@ private: class TranspositionTable { static constexpr int ClusterSize = 3; - static constexpr int ClustersPerSuperCluster = 256; struct Cluster { TTEntry entry[ClusterSize]; @@ -84,20 +83,13 @@ public: void clear(); TTEntry* first_entry(const Key key) const { - - // The index is computed from - // Idx = (K48 * SCC) / 2^40, with K48 the 48 lowest bits swizzled. - - const uint64_t firstTerm = uint32_t(key) * uint64_t(superClusterCount); - const uint64_t secondTerm = (uint16_t(key >> 32) * uint64_t(superClusterCount)) >> 16; - - return &table[(firstTerm + secondTerm) >> 24].entry[0]; + return &table[mul_hi64(key, clusterCount)].entry[0]; } private: friend struct TTEntry; - size_t superClusterCount; + size_t clusterCount; Cluster* table; void* mem; uint8_t generation8; // Size must be not bigger than TTEntry::genBound8