Skip to content

Commit

Permalink
Pyrrhic: Fix mixed-signedness comparison (#678)
Browse files Browse the repository at this point in the history
GCC 13 has made checks for mixed-signedness comparisons more stringent,
causing a build failure on Ubuntu 23.10 (pre-release). Workaround this
by adding some casts in the Pyrrhic code.

Fixes #677

No functional change.

Bench: 22069011
  • Loading branch information
skiminki authored and TerjeKir committed Sep 5, 2023
1 parent 8629234 commit 5001101
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pyrrhic/tbchess.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static uint64_t pyrrhic_pieces_by_type(const PyrrhicPosition *pos, int colour, i

static int pyrrhic_char_to_piece_type(char c) {

for (int i = PYRRHIC_PAWN; i <= PYRRHIC_KING; i++)
for (int i = PYRRHIC_PAWN; i <= (int)PYRRHIC_KING; i++)
if (c == pyrrhic_piece_to_char[i])
return i;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/pyrrhic/tbprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,13 @@ static void prt_str(const PyrrhicPosition *pos, char *str, int flip) {

int color = flip ? PYRRHIC_BLACK : PYRRHIC_WHITE;

for (int pt = PYRRHIC_KING; pt >= PYRRHIC_PAWN; pt--)
for (int pt = PYRRHIC_KING; pt >= (int)PYRRHIC_PAWN; pt--)
for (int i = PYRRHIC_POPCOUNT(pyrrhic_pieces_by_type(pos, color, pt)); i > 0; i--)
*str++ = pyrrhic_piece_to_char[pt];

*str++ = 'v';

for (int pt = PYRRHIC_KING; pt >= PYRRHIC_PAWN; pt--)
for (int pt = PYRRHIC_KING; pt >= (int)PYRRHIC_PAWN; pt--)
for (int i = PYRRHIC_POPCOUNT(pyrrhic_pieces_by_type(pos, color^1, pt)); i > 0; i--)
*str++ = pyrrhic_piece_to_char[pt];
*str++ = 0;
Expand Down

0 comments on commit 5001101

Please sign in to comment.