X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=25451da5211aef741986626c52552a5a2d7fdff9;hp=86b37e3b045a63ae92ebe1b962d132f770b55555;hb=c9d7e99de682516c560009b550c41da9ae2008b8;hpb=6738b65be97af10e4b5b783dc8ad21ae0faf36a8 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 86b37e3b..25451da5 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -233,7 +233,9 @@ namespace { }; // Pawn and material hash tables, indexed by the current thread id. - // Note that they will be initialized at 0 being global variables. + // We use per-thread tables so that once we get a pointer to an entry + // its life time is unlimited and we don't have to care about someone + // changing the entry under our feet. MaterialInfoTable* MaterialTable[MAX_THREADS]; PawnInfoTable* PawnTable[MAX_THREADS]; @@ -1156,9 +1158,7 @@ namespace { assert(eg_value(v) > -VALUE_INFINITE && eg_value(v) < VALUE_INFINITE); assert(ph >= PHASE_ENDGAME && ph <= PHASE_MIDGAME); - Value eg = eg_value(v); - Value ev = Value((eg * int(sf)) / SCALE_FACTOR_NORMAL); - + int ev = (eg_value(v) * int(sf)) / SCALE_FACTOR_NORMAL; int result = (mg_value(v) * int(ph) + ev * int(128 - ph)) / 128; return Value((result + GrainSize / 2) & ~(GrainSize - 1)); }