Move SearchStack under Search namespace

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-12-04 11:46:31 +01:00
parent 81cd417b45
commit 5b8ca1eee7
6 changed files with 45 additions and 42 deletions
+15 -16
View File
@@ -38,12 +38,6 @@
#include "tt.h"
#include "ucioption.h"
using std::cout;
using std::endl;
using std::string;
using Search::Signals;
using Search::Limits;
namespace Search {
volatile SignalsType Signals;
@@ -52,6 +46,11 @@ namespace Search {
Position RootPosition;
}
using std::cout;
using std::endl;
using std::string;
using namespace Search;
namespace {
// Set to true to force running with one thread. Used for debugging
@@ -186,10 +185,10 @@ namespace {
Move id_loop(Position& pos, Move rootMoves[], Move* ponderMove);
template <NodeType NT>
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth);
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
template <NodeType NT>
Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth);
Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta, Value *bValue);
bool connected_moves(const Position& pos, Move m1, Move m2);
@@ -213,14 +212,14 @@ namespace {
// we simply create and use a standard MovePicker object.
template<bool SpNode> struct MovePickerExt : public MovePicker {
MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b)
MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, Stack* ss, Value b)
: MovePicker(p, ttm, d, h, ss, b) {}
};
// In case of a SpNode we use split point's shared MovePicker object as moves source
template<> struct MovePickerExt<true> : public MovePicker {
MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b)
MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, Stack* ss, Value b)
: MovePicker(p, ttm, d, h, ss, b), mp(ss->sp->mp) {}
Move get_next_move() { return mp->get_next_move(); }
@@ -487,7 +486,7 @@ namespace {
Move id_loop(Position& pos, Move rootMoves[], Move* ponderMove) {
SearchStack ss[PLY_MAX_PLUS_2];
Stack ss[PLY_MAX_PLUS_2];
Value bestValues[PLY_MAX_PLUS_2];
int bestMoveChanges[PLY_MAX_PLUS_2];
int depth, aspirationDelta;
@@ -496,7 +495,7 @@ namespace {
bool bestMoveNeverChanged = true;
// Initialize stuff before a new search
memset(ss, 0, 4 * sizeof(SearchStack));
memset(ss, 0, 4 * sizeof(Stack));
TT.new_search();
H.clear();
*ponderMove = bestMove = skillBest = skillPonder = MOVE_NONE;
@@ -708,7 +707,7 @@ namespace {
// here: This is taken care of after we return from the split point.
template <NodeType NT>
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
const bool PvNode = (NT == PV || NT == Root || NT == SplitPointPV || NT == SplitPointRoot);
const bool SpNode = (NT == SplitPointPV || NT == SplitPointNonPV || NT == SplitPointRoot);
@@ -1297,7 +1296,7 @@ split_point_start: // At split points actual search starts from here
// less than ONE_PLY).
template <NodeType NT>
Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
const bool PvNode = (NT == PV);
@@ -2101,11 +2100,11 @@ void Thread::idle_loop(SplitPoint* sp) {
assert(!do_terminate);
// Copy split point position and search stack and call search()
SearchStack ss[PLY_MAX_PLUS_2];
Stack ss[PLY_MAX_PLUS_2];
SplitPoint* tsp = splitPoint;
Position pos(*tsp->pos, threadID);
memcpy(ss, tsp->ss - 1, 4 * sizeof(SearchStack));
memcpy(ss, tsp->ss - 1, 4 * sizeof(Stack));
(ss+1)->sp = tsp;
if (tsp->nodeType == Root)