]> git.sesse.net Git - stockfish/blobdiff - src/types.h
Move RootColor from Eval to Search
[stockfish] / src / types.h
index a9aa514c97ab21caf63c0a9355643c0d136148a4..ac97f7f1b0a8990a8a10c54c05e4f53905a2b70c 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "platform.h"
 
-#if defined(_WIN64)
+#if defined(_WIN64) && !defined(IS_64BIT)
 #  include <intrin.h> // MSVC popcnt and bsfq instrinsics
 #  define IS_64BIT
 #  define USE_BSFQ
 #  include <nmmintrin.h> // Intel header for _mm_popcnt_u64() intrinsic
 #endif
 
+#  if !defined(NO_PREFETCH) && (defined(__INTEL_COMPILER) || defined(_MSC_VER))
+#   include <xmmintrin.h> // Intel and Microsoft header for _mm_prefetch()
+#  endif
+
 #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
 #  define CACHE_LINE_ALIGNMENT __declspec(align(64))
 #else
@@ -140,6 +144,11 @@ enum CastlingSide {
   QUEEN_SIDE
 };
 
+enum Phase {
+  PHASE_ENDGAME = 0,
+  PHASE_MIDGAME = 128
+};
+
 enum ScaleFactor {
   SCALE_FACTOR_DRAW   = 0,
   SCALE_FACTOR_NORMAL = 64,
@@ -168,16 +177,13 @@ enum Value {
   VALUE_ENSURE_INTEGER_SIZE_P = INT_MAX,
   VALUE_ENSURE_INTEGER_SIZE_N = INT_MIN,
 
-  PawnValueMidgame   = 198,
-  PawnValueEndgame   = 258,
-  KnightValueMidgame = 817,
-  KnightValueEndgame = 846,
-  BishopValueMidgame = 836,
-  BishopValueEndgame = 857,
-  RookValueMidgame   = 1270,
-  RookValueEndgame   = 1278,
-  QueenValueMidgame  = 2521,
-  QueenValueEndgame  = 2558
+  Mg = 0, Eg = 1,
+
+  PawnValueMg   = 198,   PawnValueEg   = 258,
+  KnightValueMg = 817,   KnightValueEg = 846,
+  BishopValueMg = 836,   BishopValueEg = 857,
+  RookValueMg   = 1270,  RookValueEg   = 1278,
+  QueenValueMg  = 2521,  QueenValueEg  = 2558
 };
 
 enum PieceType {
@@ -321,9 +327,22 @@ inline Score apply_weight(Score v, Score w) {
 #undef ENABLE_OPERATORS_ON
 #undef ENABLE_SAFE_OPERATORS_ON
 
-extern const Value PieceValueMidgame[17]; // Indexed by Piece or PieceType
-extern const Value PieceValueEndgame[17];
-extern int SquareDistance[64][64];
+namespace Zobrist {
+
+  extern Key psq[2][8][64]; // [color][pieceType][square / piece count]
+  extern Key enpassant[8];  // [file]
+  extern Key castle[16];    // [castleRight]
+  extern Key side;
+  extern Key exclusion;
+
+  void init();
+}
+
+CACHE_LINE_ALIGNMENT
+
+extern Score pieceSquareTable[16][64]; // [piece][square]
+extern Value PieceValue[2][18];        // [Mg / Eg][piece / pieceType]
+extern int SquareDistance[64][64];     // [square][square]
 
 struct MoveStack {
   Move move;