Merge pull request #14 from rektdie/vectorTT

went back to vector for TT
bench 4118297
This commit was merged in pull request #14.
This commit is contained in:
rektdie authored and GitHub committed 2025-03-11 13:44:46 +01:00
commit 547e1f9172
2 files changed
+11 -2

No files matched your search

+10 -2
View File
@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "board.h" #include "board.h"
#include "search.h" #include "search.h"
#include <vector>
// 2[colors] * 6[pieces] * 64[squares] // 2[colors] * 6[pieces] * 64[squares]
extern U64 zKeys[2][6][64]; extern U64 zKeys[2][6][64];
@@ -40,10 +41,17 @@ constexpr int invalidEntry = 111111;
class TTable { class TTable {
private: private:
std::array<TTEntry, maxHash> table; std::vector<TTEntry> table;
public: public:
TTable() : table(hashSize) {};
void Resize(U64 size) {
table.resize(size);
}
void Clear() { void Clear() {
table.fill(TTEntry{}); table.clear();
table.resize(hashSize);
} }
TTEntry* GetRawEntry(U64 &hashKey) { TTEntry* GetRawEntry(U64 &hashKey) {
+1
View File
@@ -165,6 +165,7 @@ void ParseGo(Board &board, std::string &command) {
static void SetOption(std::string &command) { static void SetOption(std::string &command) {
if (command.find("Hash") != std::string::npos) { if (command.find("Hash") != std::string::npos) {
hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry); hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry);
TT.Resize(hashSize);
} }
} }