From b638f6b0354ea124dc80e5e38189474d34141e2d Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 20 Mar 2010 11:59:22 +0100 Subject: [PATCH] Remove castleRightsMask[] hack Array castleRightsMask[] is not static because it can be different for different positions, so let it be a Position member data. This allows to remove tricky hacks to take in account that although it was defined static it could change. Theoretically now copying a position is a bit slower because we need to copy also an array of 64 integers, but because in split() we don't copy the position anymore, but just keep the pointer, the added burden is not mesurable even in MP case. No functional change. Signed-off-by: Marco Costalba --- src/position.cpp | 2 -- src/position.h | 2 +- src/search.cpp | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 5b4dba70..ade1c5d2 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -44,8 +44,6 @@ using std::string; //// Variables //// -int Position::castleRightsMask[64]; - Key Position::zobrist[2][8][64]; Key Position::zobEp[64]; Key Position::zobCastle[16]; diff --git a/src/position.h b/src/position.h index 0fce1860..71f821b2 100644 --- a/src/position.h +++ b/src/position.h @@ -328,12 +328,12 @@ private: Color sideToMove; int gamePly; Key history[MaxGameLength]; + int castleRightsMask[64]; File initialKFile, initialKRFile, initialQRFile; StateInfo startState; StateInfo* st; // Static variables - static int castleRightsMask[64]; static Key zobrist[2][8][64]; static Key zobEp[64]; static Key zobCastle[16]; diff --git a/src/search.cpp b/src/search.cpp index fcadc922..4592ac08 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -441,10 +441,6 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, { TM.set_active_threads(newActiveThreads); init_eval(TM.active_threads()); - // HACK: init_eval() destroys the static castleRightsMask[] array in the - // Position class. The below line repairs the damage. - Position p(pos.to_fen()); - assert(pos.is_ok()); } // Wake up sleeping threads -- 2.39.2