]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Move SearchStack under Search namespace
[stockfish] / src / search.cpp
index e625405d5eec56d9759df974dfda90cc898aa2d8..77acd89e39b12310d5333708de19c5c85c7a883f 100644 (file)
 #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)