Make enums unsigned

Speed up by using unsigned enums.

Passed STC:
LLR: 2.98 (-2.94,2.94) <0.00,2.00>
Total: 49248 W: 12894 L: 12568 D: 23786
Ptnml(0-2): 119, 5353, 13397, 5593, 16
https://tests.stockfishchess.org/tests/view/695e3e5002d0182a589fe965

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

No functional change
This commit is contained in:
KazApps
2026-01-10 16:06:18 +01:00
committed by Joost VandeVondele
parent 9b8c5c9f75
commit d852a9195e
6 changed files with 31 additions and 21 deletions
+12 -5
View File
@@ -66,12 +66,15 @@ std::ostream& operator<<(std::ostream& os, const Position& pos) {
os << "\n +---+---+---+---+---+---+---+---+\n";
for (Rank r = RANK_8; r >= RANK_1; --r)
for (Rank r = RANK_8;; --r)
{
for (File f = FILE_A; f <= FILE_H; ++f)
os << " | " << PieceToChar[pos.piece_on(make_square(f, r))];
os << " | " << (1 + r) << "\n +---+---+---+---+---+---+---+---+\n";
if (r == RANK_1)
break;
}
os << " a b c d e f g h\n"
@@ -416,7 +419,7 @@ string Position::fen() const {
int emptyCnt;
std::ostringstream ss;
for (Rank r = RANK_8; r >= RANK_1; --r)
for (Rank r = RANK_8;; --r)
{
for (File f = FILE_A; f <= FILE_H; ++f)
{
@@ -430,8 +433,9 @@ string Position::fen() const {
ss << PieceToChar[piece_on(make_square(f, r))];
}
if (r > RANK_1)
ss << '/';
if (r == RANK_1)
break;
ss << '/';
}
ss << (sideToMove == WHITE ? " w " : " b ");
@@ -1477,10 +1481,13 @@ void Position::flip() {
string f, token;
std::stringstream ss(fen());
for (Rank r = RANK_8; r >= RANK_1; --r) // Piece placement
for (Rank r = RANK_8;; --r) // Piece placement
{
std::getline(ss, token, r > RANK_1 ? '/' : ' ');
f.insert(0, token + (f.empty() ? " " : "/"));
if (r == RANK_1)
break;
}
ss >> token; // Active color