]> git.sesse.net Git - stockfish/blobdiff - src/nnue/nnue_common.h
Use C++17 variable templates for type traits
[stockfish] / src / nnue / nnue_common.h
index e8ed2bc68e75dbb20cd47a644e3a46e171c4edb3..e159c5dc3dac0f0300e572a9985404bc4b9fadde 100644 (file)
 #ifndef NNUE_COMMON_H_INCLUDED
 #define NNUE_COMMON_H_INCLUDED
 
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
 #include <cstring>
 #include <iostream>
+#include <type_traits>
 
-#include "../misc.h"  // for IsLittleEndian
+#include "../misc.h"
 
 #if defined(USE_AVX2)
 #include <immintrin.h>
@@ -99,7 +103,7 @@ namespace Stockfish::Eval::NNUE {
       else
       {
           std::uint8_t u[sizeof(IntType)];
-          typename std::make_unsigned<IntType>::type v = 0;
+          std::make_unsigned_t<IntType> v = 0;
 
           stream.read(reinterpret_cast<char*>(u), sizeof(IntType));
           for (std::size_t i = 0; i < sizeof(IntType); ++i)
@@ -124,7 +128,7 @@ namespace Stockfish::Eval::NNUE {
       else
       {
           std::uint8_t u[sizeof(IntType)];
-          typename std::make_unsigned<IntType>::type v = value;
+          std::make_unsigned_t<IntType> v = value;
 
           std::size_t i = 0;
           // if constexpr to silence the warning about shift by 8