mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 05:07:46 +00:00
Use C++17 variable templates for type traits
The C++17 variable templates are slightly more readable and allow us to remove the typename keyword in a few cases. closes https://github.com/official-stockfish/Stockfish/pull/4806 No functional change
This commit is contained in:
committed by
Disservin
parent
31d0b7fe93
commit
4f0fecad8a
@@ -102,7 +102,7 @@ constexpr Value WDL_to_value[] = {
|
||||
template<typename T, int Half = sizeof(T) / 2, int End = sizeof(T) - 1>
|
||||
inline void swap_endian(T& x)
|
||||
{
|
||||
static_assert(std::is_unsigned<T>::value, "Argument of swap_endian not unsigned");
|
||||
static_assert(std::is_unsigned_v<T>, "Argument of swap_endian not unsigned");
|
||||
|
||||
uint8_t tmp, *c = (uint8_t*)&x;
|
||||
for (int i = 0; i < Half; ++i)
|
||||
@@ -332,7 +332,7 @@ struct PairsData {
|
||||
// first access, when the corresponding file is memory mapped.
|
||||
template<TBType Type>
|
||||
struct TBTable {
|
||||
using Ret = typename std::conditional<Type == WDL, WDLScore, int>::type;
|
||||
using Ret = std::conditional_t<Type == WDL, WDLScore, int>;
|
||||
|
||||
static constexpr int Sides = Type == WDL ? 2 : 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user