mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-24 11:52:54 +00:00
fix: only use InterlockedCompareExchangeRelease64 on LP64 systems
This commit is contained in:
parent
caf7128d58
commit
b598aa9232
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue