X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=c3911446e7ab38c0528a27ee941033d182bd82bf;hp=f74ba8d52fedd04b798c9528141e5420456e61cb;hb=ccd823a4ffd2ed3e60cb03ab49a841742bae1994;hpb=c9e396b5424802b80e80394979ca84688b523244 diff --git a/src/types.h b/src/types.h index f74ba8d5..c3911446 100644 --- a/src/types.h +++ b/src/types.h @@ -136,7 +136,7 @@ enum CastlingSide { KING_SIDE, QUEEN_SIDE, CASTLING_SIDE_NB = 2 }; -enum CastlingRight { // Defined as in PolyGlot book hash key +enum CastlingRight { NO_CASTLING, WHITE_OO, WHITE_OOO = WHITE_OO << 1, @@ -218,7 +218,7 @@ enum Depth { DEPTH_QS_NO_CHECKS = -1 * ONE_PLY, DEPTH_QS_RECAPTURES = -5 * ONE_PLY, - DEPTH_NONE = -127 * ONE_PLY + DEPTH_NONE = -6 * ONE_PLY }; enum Square { @@ -272,23 +272,14 @@ inline Score make_score(int mg, int eg) { return Score((mg << 16) + eg); } /// Extracting the signed lower and upper 16 bits is not so trivial because /// according to the standard a simple cast to short is implementation defined /// and so is a right shift of a signed integer. -inline Value mg_value(Score s) { return Value(((s + 0x8000) & ~0xffff) / 0x10000); } - -/// On Intel 64 bit we have a small speed regression with the standard conforming -/// version. Therefore, in this case we use faster code that, although not 100% -/// standard compliant, seems to work for Intel and MSVC. -#if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER)) - -inline Value eg_value(Score s) { return Value(int16_t(s & 0xFFFF)); } - -#else +inline Value mg_value(Score s) { + return Value(((s + 0x8000) & ~0xffff) / 0x10000); +} inline Value eg_value(Score s) { return Value((int)(unsigned(s) & 0x7FFFU) - (int)(unsigned(s) & 0x8000U)); } -#endif - #define ENABLE_BASE_OPERATORS_ON(T) \ inline T operator+(const T d1, const T d2) { return T(int(d1) + int(d2)); } \ inline T operator-(const T d1, const T d2) { return T(int(d1) - int(d2)); } \ @@ -335,6 +326,8 @@ inline Score operator/(Score s, int i) { return make_score(mg_value(s) / i, eg_value(s) / i); } +CACHE_LINE_ALIGNMENT + extern Value PieceValue[PHASE_NB][PIECE_NB]; struct ExtMove {