mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Fix a possible overflow in TT resize
On platforms where size_t is 32 bit, we can have an overflow in this expression: (mbSize * 1024 * 1024) Fix it setting max hash size of 2GB on platforms where size_t is 32 bit. A small rename while there: now struct Cluster is definied inside class TranspositionTable so we should drop the redundant TT prefix. No functional change.
This commit is contained in:
4
src/tt.h
4
src/tt.h
@@ -76,7 +76,7 @@ class TranspositionTable {
|
||||
static const int CacheLineSize = 64;
|
||||
static const int TTClusterSize = 3;
|
||||
|
||||
struct TTCluster {
|
||||
struct Cluster {
|
||||
TTEntry entry[TTClusterSize];
|
||||
char padding[2]; // Align to the cache line size
|
||||
};
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
private:
|
||||
size_t clusterCount;
|
||||
TTCluster* table;
|
||||
Cluster* table;
|
||||
void* mem;
|
||||
uint8_t generation8; // Size must be not bigger than TTEntry::genBound8
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user