Minor cleanups

simplify and relocate to position.cpp some of the recent threat calculations used in the movepicker.

passed STC:
https://tests.stockfishchess.org/tests/view/62468c301f682ea45ce3b3b9
LLR: 2.96 (-2.94,2.94) <-2.25,0.25>
Total: 76544 W: 20247 L: 20152 D: 36145
Ptnml(0-2): 327, 8113, 21317, 8168, 347

closes https://github.com/official-stockfish/Stockfish/pull/3972

No functional change
This commit is contained in:
mstembera
2022-03-30 18:14:27 -07:00
committed by Joost VandeVondele
parent 471d93063a
commit 9f6bcb38c0
3 changed files with 34 additions and 62 deletions

View File

@@ -90,9 +90,6 @@ static inline const bool IsLittleEndian = (Le.c[0] == 4);
class RunningAverage {
public:
// Constructor
RunningAverage() {}
// Reset the running average to rational value p / q
void set(int64_t p, int64_t q)
{ average = p * PERIOD * RESOLUTION / q; }
@@ -102,10 +99,10 @@ class RunningAverage {
{ average = RESOLUTION * v + (PERIOD - 1) * average / PERIOD; }
// Test if average is strictly greater than rational a / b
bool is_greater(int64_t a, int64_t b)
{ return b * average > a * PERIOD * RESOLUTION ; }
bool is_greater(int64_t a, int64_t b) const
{ return b * average > a * (PERIOD * RESOLUTION); }
int64_t value()
int64_t value() const
{ return average / (PERIOD * RESOLUTION); }
private :