Skip to content

Commit

Permalink
Set 2GB TT size limit for 32 bits
Browse files Browse the repository at this point in the history
Import this simplified version
that has been committed upstream.

Now TT code is the same of official.

No functional change.
  • Loading branch information
mcostalba committed Jan 17, 2015
2 parents 24df710 + 595fc34 commit c5f6f47
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/tt.cpp
Expand Up @@ -30,11 +30,10 @@ TranspositionTable TT; // Our global transposition table
/// measured in megabytes. Transposition table consists of a power of 2 number
/// of clusters and each cluster consists of TTClusterSize number of TTEntry.

void TranspositionTable::resize(uint64_t mbSize) {
void TranspositionTable::resize(size_t mbSize) {

assert(sizeof(Cluster) == CacheLineSize / 2);

// Here mbSize should be 64 bit to not overflow (mbSize * 1024 * 1024)
size_t newClusterCount = size_t(1) << msb((mbSize * 1024 * 1024) / sizeof(Cluster));

if (newClusterCount == clusterCount)
Expand Down
2 changes: 1 addition & 1 deletion src/tt.h
Expand Up @@ -86,7 +86,7 @@ class TranspositionTable {
void new_search() { generation8 += 4; } // Lower 2 bits are used by Bound
uint8_t generation() const { return generation8; }
TTEntry* probe(const Key key, bool& found) const;
void resize(uint64_t mbSize);
void resize(size_t mbSize);
void clear();

// The lowest order bits of the key are used to get the index of the cluster
Expand Down
2 changes: 1 addition & 1 deletion src/ucioption.cpp
Expand Up @@ -52,7 +52,7 @@ bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const

void init(OptionsMap& o) {

const int MaxHashMB = Is64Bit ? 1024 * 1024 : 65536;
const int MaxHashMB = Is64Bit ? 1024 * 1024 : 2048;

o["Write Debug Log"] << Option(false, on_logger);
o["Contempt"] << Option(0, -100, 100);
Expand Down

0 comments on commit c5f6f47

Please sign in to comment.