mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 03:29:14 +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:
parent
a091ae4cc8
commit
fa3f6dcbea
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue