1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Correct zero-init of Thread data members

If not explicitly initialized in a class constructor,
then all data members are default-initialized when
the corresponing struct/class is instanced.

For array and built-in types (int, char, etc..)
default-initialization is a no-op and we need to
explicitly zero them.

No functional change.
This commit is contained in:
Marco Costalba 2017-01-05 08:50:17 +01:00
parent 6b16ebc825
commit fe99de20ff
2 changed files with 1 additions and 2 deletions

View file

@ -41,6 +41,7 @@ struct Stats {
static const Value Max = Value(1 << 28);
Stats() { clear(); }
const T* operator[](Piece pc) const { return table[pc]; }
T* operator[](Piece pc) { return table[pc]; }
void clear() { std::memset(table, 0, sizeof(table)); }

View file

@ -37,8 +37,6 @@ Thread::Thread() {
resetCalls = exit = false;
maxPly = callsCnt = 0;
tbHits = 0;
history.clear();
counterMoves.clear();
idx = Threads.size(); // Start from 0
std::unique_lock<Mutex> lk(mutex);