]> git.sesse.net Git - stockfish/commitdiff
Workaround a static data member bug in MSVC
authorMarco Costalba <mcostalba@gmail.com>
Sun, 12 Oct 2008 21:16:10 +0000 (22:16 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 13 Oct 2008 18:40:47 +0000 (20:40 +0200)
Without this patch MSVC crashes when compiled
in release mode. It survives and works as
expected in debug mode and with gcc and Intel
compilers.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movepick.cpp
src/movepick.h

index a18c46923b60742160816fddb3d9c8ff2734dc35..4d2d31167ea2db2641c582c545ba3c6c46b1a0fe 100644 (file)
@@ -38,6 +38,7 @@ namespace {
 
   /// Variables
 
+  MovePicker::MovegenPhase PhaseTable[32];  
   int MainSearchPhaseIndex;
   int EvasionsPhaseIndex;
   int QsearchWithChecksPhaseIndex;
@@ -45,8 +46,6 @@ namespace {
 
 }
 
-// Static array definition
-MovePicker::MovegenPhase MovePicker::PhaseTable[32];
 
 
 ////
@@ -440,6 +439,9 @@ Move MovePicker::pick_move_from_list() {
   return MOVE_NONE;
 }
 
+MovePicker::MovegenPhase MovePicker::current_move_type() const {
+  return PhaseTable[phaseIndex];
+}
 
 /// MovePicker::init_phase_table() initializes the PhaseTable[],
 /// MainSearchPhaseIndex, EvasionPhaseIndex, QsearchWithChecksPhaseIndex
index 10f0e8ef5c66a7ee30ddba345063b332c5de40db..df2012fe6fa0b67bbe2ade133744d39ab4b8b6e7 100644 (file)
@@ -81,7 +81,6 @@ private:
   Move ttMove, mateKiller, killer1, killer2;
   Bitboard pinned, dc;
   MoveStack moves[256], badCaptures[64];
-  static MovegenPhase PhaseTable[32];
   bool pvNode;
   Depth depth;
   int phaseIndex;
@@ -99,10 +98,6 @@ private:
 /// all pieces which can possibly give discovered check.  This bitboard is
 /// computed by the constructor function.
 
-inline MovePicker::MovegenPhase MovePicker::current_move_type() const {
-  return PhaseTable[phaseIndex];
-}
-
 inline Bitboard MovePicker::discovered_check_candidates() const {
   return dc;
 }