]> git.sesse.net Git - stockfish/blobdiff - src/tt.h
Allow for general transposition table sizes. (#1341)
[stockfish] / src / tt.h
index 24045ed0f40c879056dbbca5e6e7cfa776e5641e..e1bef323af5092474f07a96db48ff2d8fb8b4e9f 100644 (file)
--- a/src/tt.h
+++ b/src/tt.h
@@ -104,9 +104,9 @@ public:
   void resize(size_t mbSize);
   void clear();
 
-  // The lowest order bits of the key are used to get the index of the cluster
+  // 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[(size_t)key & (clusterCount - 1)].entry[0];
+    return &table[(uint32_t(key) * uint64_t(clusterCount)) >> 32].entry[0];
   }
 
 private: