From b598aa9232c11939e2a5b18681976be0b9385015 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Wed, 25 Mar 2026 19:20:18 -0500 Subject: [PATCH] fix: only use `InterlockedCompareExchangeRelease64` on LP64 systems --- Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h index a2f76c701..5aea5dc23 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h @@ -336,6 +336,7 @@ static inline VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) { static inline DWORD GetLastError(VOID) { return errno; } +#ifdef __LP64__ static inline LONG64 InterlockedCompareExchangeRelease64( LONG64 volatile* Destination, LONG64 Exchange, LONG64 Comperand) { LONG64 expected = Comperand; @@ -343,6 +344,15 @@ static inline LONG64 InterlockedCompareExchangeRelease64( __ATOMIC_RELEASE, __ATOMIC_RELAXED); return expected; } +#else +static inline LONG64 InterlockedCompareExchangeRelease( + LONG volatile* Destination, LONG Exchange, LONG Comperand) { + LONG expected = Comperand; + __atomic_compare_exchange_n(Destination, &expected, Exchange, false, + __ATOMIC_RELEASE, __ATOMIC_RELAXED); + return expected; +} +#endif // internal helper: convert time_t to FILETIME (100ns intervals since // 1601-01-01)