From bf43bbae31db89de32743b80e8a98cf2dd41ca85 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 26 Apr 2026 21:40:50 +0200 Subject: [PATCH] stdinc: excplicitly cast output of __builtin_bswap32 to Uint32 This fixes a compile warning when using the output of SDL_Swap32 directly using the SDL_PRIu32 macro in C90 mode: testplatform.c:158:17: warning: format '%lX' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat=] 158 | SDL_Log("Value 32 = 0x%" SDL_PRIX32 ", swapped = 0x%" SDL_PRIX32, | --- include/SDL3/SDL_endian.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_endian.h b/include/SDL3/SDL_endian.h index 69f097edd8..7bb56740a5 100644 --- a/include/SDL3/SDL_endian.h +++ b/include/SDL3/SDL_endian.h @@ -286,7 +286,7 @@ SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) /* Byte swap 32-bit integer. */ #ifndef SDL_WIKI_DOCUMENTATION_SECTION #if HAS_BUILTIN_BSWAP32 -#define SDL_Swap32(x) __builtin_bswap32(x) +#define SDL_Swap32(x) (Uint32)__builtin_bswap32(x) #elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #pragma intrinsic(_byteswap_ulong) #define SDL_Swap32(x) _byteswap_ulong(x)