Use std::abs over abs

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

No functional change

Co-Authored-By: fffelix-huang <72808219+fffelix-huang@users.noreply.github.com>
This commit is contained in:
FauziAkram
2023-12-18 16:20:41 +03:00
committed by Disservin
parent 07a2619b62
commit a069a1bbbf
7 changed files with 20 additions and 16 deletions

View File

@@ -21,6 +21,7 @@
#include <array>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <limits>
@@ -55,12 +56,12 @@ class StatsEntry {
operator const T&() const { return entry; }
void operator<<(int bonus) {
assert(abs(bonus) <= D); // Ensure range is [-D, D]
assert(std::abs(bonus) <= D); // Ensure range is [-D, D]
static_assert(D <= std::numeric_limits<T>::max(), "D overflows T");
entry += bonus - entry * abs(bonus) / D;
entry += bonus - entry * std::abs(bonus) / D;
assert(abs(entry) <= D);
assert(std::abs(entry) <= D);
}
};