mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 01:27:16 +08: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:
@@ -20,7 +20,6 @@
|
|||||||
#ifndef SEARCH_H_INCLUDED
|
#ifndef SEARCH_H_INCLUDED
|
||||||
#define SEARCH_H_INCLUDED
|
#define SEARCH_H_INCLUDED
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -78,7 +77,10 @@ struct RootMove {
|
|||||||
|
|
||||||
struct LimitsType {
|
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); }
|
bool use_time_management() const { return !(mate | movetime | depth | nodes | infinite); }
|
||||||
|
|
||||||
std::vector<Move> searchmoves;
|
std::vector<Move> searchmoves;
|
||||||
|
|||||||
Reference in New Issue
Block a user