Use only standard conforming eg_value()

Remove the optimization for Intel, is not
standard and can break at any time, moreover
our release build is not done with Intel C++
anymore so we don't need to sqeeze the extra
speed out from this compiler.

No functional change.
This commit is contained in:
Marco Costalba
2014-05-01 23:08:07 +02:00
parent bee4f1cf09
commit 43973f43c6

View File

@@ -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 /// 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 /// according to the standard a simple cast to short is implementation defined
/// and so is a right shift of a signed integer. /// and so is a right shift of a signed integer.
inline Value mg_value(Score s) { return Value(((s + 0x8000) & ~0xffff) / 0x10000); } 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 eg_value(Score s) { inline Value eg_value(Score s) {
return Value((int)(unsigned(s) & 0x7FFFU) - (int)(unsigned(s) & 0x8000U)); return Value((int)(unsigned(s) & 0x7FFFU) - (int)(unsigned(s) & 0x8000U));
} }
#endif
#define ENABLE_BASE_OPERATORS_ON(T) \ #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)); } \
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)); } \