Replace std::mins/max with clamp function (#2062)

Adding a clamp function makes some of these range limitations a bit prettier and removes some #include's.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 28117 W: 6300 L: 6191 D: 15626
http://tests.stockfishchess.org/tests/view/5c9aa1df0ebc5925cfff8fcc

Non functional change.
This commit is contained in:
protonspring
2019-03-31 02:48:27 -06:00
committed by Marco Costalba
parent d1f76ebcd8
commit c858990377
12 changed files with 7 additions and 14 deletions

View File

@@ -249,6 +249,9 @@ template<typename T1, typename T2> inline int distance(T2 x, T2 y);
template<> inline int distance<File>(Square x, Square y) { return distance(file_of(x), file_of(y)); }
template<> inline int distance<Rank>(Square x, Square y) { return distance(rank_of(x), rank_of(y)); }
template<class T> constexpr const T& clamp(const T& v, const T& lo, const T& hi) {
return v < lo ? lo : v > hi ? hi : v;
}
/// attacks_bb() returns a bitboard representing all the squares attacked by a
/// piece of type Pt (bishop or rook) placed on 's'.