mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 02:57:11 +08:00
Make casting styles consistent
Make casting styles consistent with the rest of the code. closes https://github.com/official-stockfish/Stockfish/pull/4793 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
952740b36c
commit
fce4cc1829
20
src/tt.cpp
20
src/tt.cpp
@@ -39,22 +39,22 @@ TranspositionTable TT; // Our global transposition table
|
||||
void TTEntry::save(Key k, Value v, bool pv, Bound b, Depth d, Move m, Value ev) {
|
||||
|
||||
// Preserve any existing move for the same position
|
||||
if (m || (uint16_t)k != key16)
|
||||
move16 = (uint16_t)m;
|
||||
if (m || uint16_t(k) != key16)
|
||||
move16 = uint16_t(m);
|
||||
|
||||
// Overwrite less valuable entries (cheapest checks first)
|
||||
if ( b == BOUND_EXACT
|
||||
|| (uint16_t)k != key16
|
||||
|| uint16_t(k) != key16
|
||||
|| d - DEPTH_OFFSET + 2 * pv > depth8 - 4)
|
||||
{
|
||||
assert(d > DEPTH_OFFSET);
|
||||
assert(d < 256 + DEPTH_OFFSET);
|
||||
|
||||
key16 = (uint16_t)k;
|
||||
depth8 = (uint8_t)(d - DEPTH_OFFSET);
|
||||
genBound8 = (uint8_t)(TT.generation8 | uint8_t(pv) << 2 | b);
|
||||
value16 = (int16_t)v;
|
||||
eval16 = (int16_t)ev;
|
||||
key16 = uint16_t(k);
|
||||
depth8 = uint8_t(d - DEPTH_OFFSET);
|
||||
genBound8 = uint8_t(TT.generation8 | uint8_t(pv) << 2 | b);
|
||||
value16 = int16_t(v);
|
||||
eval16 = int16_t(ev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,14 +123,14 @@ void TranspositionTable::clear() {
|
||||
TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
|
||||
|
||||
TTEntry* const tte = first_entry(key);
|
||||
const uint16_t key16 = (uint16_t)key; // Use the low 16 bits as key inside the cluster
|
||||
const uint16_t key16 = uint16_t(key); // Use the low 16 bits as key inside the cluster
|
||||
|
||||
for (int i = 0; i < ClusterSize; ++i)
|
||||
if (tte[i].key16 == key16 || !tte[i].depth8)
|
||||
{
|
||||
tte[i].genBound8 = uint8_t(generation8 | (tte[i].genBound8 & (GENERATION_DELTA - 1))); // Refresh
|
||||
|
||||
return found = (bool)tte[i].depth8, &tte[i];
|
||||
return found = bool(tte[i].depth8), &tte[i];
|
||||
}
|
||||
|
||||
// Find an entry to be replaced according to the replacement strategy
|
||||
|
||||
Reference in New Issue
Block a user