mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 03:26:24 +08:00
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:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user