From f16556e2ffb252178bff2fd4b5219d3a78f9fbfa Mon Sep 17 00:00:00 2001 From: rektdie Date: Tue, 11 Mar 2025 11:56:57 +0100 Subject: [PATCH] went back to vector for TT --- source/tt.h | 14 ++++++++++---- source/uci.cpp | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/tt.h b/source/tt.h index 872990c..a2e7576 100644 --- a/source/tt.h +++ b/source/tt.h @@ -1,6 +1,7 @@ #pragma once #include "board.h" #include "search.h" +#include // 2[colors] * 6[pieces] * 64[squares] extern U64 zKeys[2][6][64]; @@ -29,8 +30,6 @@ public: } }; -// 256 MB -constexpr U64 maxHash = (64* 1000000) / sizeof(TTEntry); // 5 MB constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry); @@ -40,10 +39,17 @@ constexpr int invalidEntry = 111111; class TTable { private: - std::array table; + std::vector table; public: + TTable() : table(hashSize) {}; + + void Resize(U64 size) { + table.resize(size); + } + void Clear() { - table.fill(TTEntry{}); + table.clear(); + table.resize(hashSize); } TTEntry* GetRawEntry(U64 &hashKey) { diff --git a/source/uci.cpp b/source/uci.cpp index 8e7aaa0..42480b0 100644 --- a/source/uci.cpp +++ b/source/uci.cpp @@ -165,6 +165,7 @@ void ParseGo(Board &board, std::string &command) { static void SetOption(std::string &command) { if (command.find("Hash") != std::string::npos) { hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry); + TT.Resize(hashSize); } } -- 2.47.3