1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 11:39:15 +00:00

Fix a crash under MSVC

Using memset on a std::vector is undefined behavior,
so manually init all the data memebers of LimitsType.

Bug intorduced in 41641e3b1e

No functional change.
This commit is contained in:
Marco Costalba 2014-03-16 10:55:58 +01:00
parent a091ae4cc8
commit fa3f6dcbea

View file

@ -20,7 +20,6 @@
#ifndef SEARCH_H_INCLUDED
#define SEARCH_H_INCLUDED
#include <cstring>
#include <memory>
#include <stack>
#include <vector>
@ -78,7 +77,10 @@ struct RootMove {
struct LimitsType {
LimitsType() { std::memset(this, 0, sizeof(LimitsType)); }
LimitsType() { // Using memset on a std::vector is undefined behavior
time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] = movestogo =
depth = nodes = movetime = mate = infinite = ponder = 0;
}
bool use_time_management() const { return !(mate | movetime | depth | nodes | infinite); }
std::vector<Move> searchmoves;