Consistent Integer Types

example of using, to avoid mixed usage of std::uint/std::int and uint/int...
```cpp
using u64 = std::uint64_t;
using u32 = std::uint32_t;
using u16 = std::uint16_t;
using u8  = std::uint8_t;

using i64 = std::int64_t;
using i32 = std::int32_t;
using i16 = std::int16_t;
using i8  = std::int8_t;

using usize = std::size_t;
using isize = std::ptrdiff_t;

#if defined(__GNUC__) && defined(IS_64BIT)
__extension__ using u128 = unsigned __int128;
__extension__ using i128 = signed __int128;
#endif
```

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

No functional change
This commit is contained in:
Disservin
2026-06-08 19:54:33 +02:00
committed by Joost VandeVondele
parent e4a635486a
commit dd3e1c4a50
50 changed files with 787 additions and 799 deletions
+7 -7
View File
@@ -39,7 +39,7 @@ alignas(64) Magic Magics[SQUARE_NB][2];
}
#ifdef USE_PEXT
using MagicMask = uint16_t;
using MagicMask = u16;
#else
using MagicMask = Bitboard;
#endif
@@ -77,10 +77,10 @@ static void init_magics(Magic magics[][2]) {
// Sliding attacks within a rank, indexed by the slider's file and the
// 8-bit rank occupancy, yielding the 8-bit attack set on that rank
constexpr auto RankAttacks = []() {
std::array<std::array<uint8_t, 256>, FILE_NB> table{};
std::array<std::array<u8, 256>, FILE_NB> table{};
for (int file = 0; file < 8; ++file)
for (int occ = 0; occ < 256; ++occ)
table[file][occ] = uint8_t(sliding_attack(ROOK, Square(file), occ));
table[file][occ] = u8(sliding_attack(ROOK, Square(file), occ));
return table;
}();
@@ -198,14 +198,14 @@ constexpr
#if defined(USE_COMPTIME_ATTACKS) && defined(USE_PEXT)
constexpr auto RookTable = []() {
std::array<uint16_t, 0x19000> result{};
Magic magics[64][2] = {};
std::array<u16, 0x19000> result{};
Magic magics[64][2] = {};
init_magics(ROOK, result.data(), magics, false);
return result;
}();
constexpr auto BishopTable = []() {
std::array<uint16_t, 0x1480> result{};
Magic magics[64][2] = {};
std::array<u16, 0x1480> result{};
Magic magics[64][2] = {};
init_magics(BISHOP, result.data(), magics, false);
return result;
}();