1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Correctly round evaluation to grain size

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-02-21 12:45:51 +01:00
parent 23cbb221b2
commit dd718d92a7

View file

@ -1105,7 +1105,7 @@ namespace {
Value ev = Value((eg * int(sf)) / SCALE_FACTOR_NORMAL);
int result = (mg_value(v) * int(ph) + ev * int(128 - ph)) / 128;
return Value(result & ~(GrainSize - 1));
return Value((result + GrainSize / 2) & ~(GrainSize - 1));
}