went back to vector for TT

This commit is contained in:
rektdie committed 2025-03-11 11:56:57 +01:00
1 parent 60ed5c2c2b
commit f16556e2ff
2 files changed
+11 -4

No files matched your search

+10 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include "board.h"
#include "search.h"
#include <vector>
// 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<TTEntry, maxHash> table;
std::vector<TTEntry> 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) {
+1
View File
@@ -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);
}
}