};
// 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];
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));
}