mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 09:37:16 +08:00
Microptimize first_entry() for 32bits
Do a 32bit bitwise 'and' instead of a 64bit subtract and bitwise 'and'. This is possible because even in the biggest hash table case (8GB) the number of entries is 2^29 so storable in an unsigned int. No functional change.
This commit is contained in:
4
src/tt.h
4
src/tt.h
@@ -96,7 +96,7 @@ public:
|
||||
void store(const Key key, Value v, Bound type, Depth d, Move m, Value statV, Value kingD);
|
||||
|
||||
private:
|
||||
size_t size;
|
||||
uint32_t clusterMask;
|
||||
TTEntry* entries;
|
||||
uint8_t generation; // Size must be not bigger then TTEntry::generation8
|
||||
};
|
||||
@@ -110,7 +110,7 @@ extern TranspositionTable TT;
|
||||
|
||||
inline TTEntry* TranspositionTable::first_entry(const Key key) const {
|
||||
|
||||
return entries + ((uint32_t)key & (size - 1)) * ClusterSize;
|
||||
return entries + ((uint32_t)key & clusterMask) * ClusterSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user