From b25cb6ea63eaa028da7855dbbfa11f35eb89914c Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 10 Apr 2025 16:43:58 +0000 Subject: [PATCH] Use int32_t for x86_cpuid flags and handle MSVC types Change the flags parameter to int32_t for explicit sizing. Add a check and cast for MSVC __cpuid compatibility when int is 32-bit. This silences a -Wincompatible-pointer-types warning where int32_t is long int. --- libretro-common/features/features_cpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index a7176c5b62..679c09c36d 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -269,7 +269,8 @@ retro_time_t cpu_features_get_time_usec(void) #endif #if defined(CPU_X86) && !defined(__MACH__) -void x86_cpuid(int func, int flags[4]) +#include +void x86_cpuid(int func, int32_t flags[4]) { /* On Android, we compile RetroArch with PIC, and we * are not allowed to clobber the ebx register. */ @@ -288,8 +289,8 @@ void x86_cpuid(int func, int flags[4]) "xchg %%" REG_b ", %%" REG_S "\n" : "=a"(flags[0]), "=S"(flags[1]), "=c"(flags[2]), "=d"(flags[3]) : "a"(func)); -#elif defined(_MSC_VER) - __cpuid(flags, func); +#elif defined(_MSC_VER) && INT_MAX == 2147483647 + __cpuid((int*)flags, func); #else #ifndef NDEBUG printf("Unknown compiler. Cannot check CPUID with inline assembly.\n");