mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 00:26:33 +08:00
Use std::stack instead of fixed size array
Only in not performance critical code like pretty_pv(), otherwise continue to use the good old C-style arrays like in extract/insert PV where I have done some code refactoring anyhow. No functional change.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include <cassert>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <stack>
|
||||
|
||||
#include "movegen.h"
|
||||
#include "notation.h"
|
||||
@@ -226,7 +226,7 @@ string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[]
|
||||
const int64_t K = 1000;
|
||||
const int64_t M = 1000000;
|
||||
|
||||
StateInfo state[MAX_PLY_PLUS_2], *st = state;
|
||||
std::stack<StateInfo> st;
|
||||
Move* m = pv;
|
||||
string san, padding;
|
||||
size_t length;
|
||||
@@ -261,7 +261,8 @@ string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[]
|
||||
s << san << ' ';
|
||||
length += san.length() + 1;
|
||||
|
||||
pos.do_move(*m++, *st++);
|
||||
st.push(StateInfo());
|
||||
pos.do_move(*m++, st.top());
|
||||
}
|
||||
|
||||
while (m != pv)
|
||||
|
||||
Reference in New Issue
Block a user