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:
Marco Costalba
2013-02-09 10:22:34 +01:00
parent fe3352665b
commit c698362680
2 changed files with 8 additions and 6 deletions

View File

@@ -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;
}