Revert "removed hashSize global | bench 1857933"
This reverts commit 3aad0d90ee.
This commit is contained in:
1 parent
3aad0d90ee
commit
0242eec87d
3 files changed
+8
-7
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include "tt.h"
|
||||
|
||||
SEARCH::SearchResults TTable::ReadEntry(U64 &hashKey, int depth, int alpha, int beta) {
|
||||
TTEntry *current = &table[hashKey % table.size()];
|
||||
TTEntry *current = &table[hashKey % hashSize];
|
||||
|
||||
if (current->hashKey == hashKey) {
|
||||
if (current->depth >= depth) {
|
||||
@@ -20,7 +20,7 @@ SEARCH::SearchResults TTable::ReadEntry(U64 &hashKey, int depth, int alpha, int
|
||||
}
|
||||
|
||||
void TTable::WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove) {
|
||||
TTEntry *current = &table[hashKey % table.size()];
|
||||
TTEntry *current = &table[hashKey % hashSize];
|
||||
|
||||
current->hashKey = hashKey;
|
||||
current->nodeType = nodeType;
|
||||
|
||||
+5
-4
@@ -21,26 +21,27 @@ constexpr U64 maxHash = (64* 1000000) / sizeof(TTEntry);
|
||||
// 5 MB
|
||||
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
|
||||
|
||||
inline U64 hashSize = defaultHash;
|
||||
|
||||
constexpr int invalidEntry = 111111;
|
||||
|
||||
class TTable {
|
||||
private:
|
||||
std::vector<TTEntry> table;
|
||||
public:
|
||||
TTable() : table(defaultHash) {};
|
||||
TTable() : table(hashSize) {};
|
||||
|
||||
void Resize(U64 size) {
|
||||
table.resize(size);
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
U64 size = table.size();
|
||||
table.clear();
|
||||
table.resize(size);
|
||||
table.resize(hashSize);
|
||||
}
|
||||
|
||||
TTEntry* GetRawEntry(U64 &hashKey) {
|
||||
TTEntry *current = &table[hashKey % table.size()];
|
||||
TTEntry *current = &table[hashKey % hashSize];
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ static void ParseGo(Board &board, std::string &command, SEARCH::SearchContext& c
|
||||
|
||||
static void SetOption(std::string &command, SEARCH::SearchContext& ctx) {
|
||||
if (command.find("Hash") != std::string::npos) {
|
||||
U64 hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry);
|
||||
hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry);
|
||||
ctx.TT->Resize(hashSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user