forked from OSchip/llvm-project
sanitizer_atomic_msvc.h: add atomic_fetch_{add,sub} overloads for uintptr_t
This should hopefully unbreak the MSVC build after r206178. llvm-svn: 206200
This commit is contained in:
parent
ec77f619bb
commit
8f80ccc635
|
@ -26,6 +26,9 @@ extern "C" long _InterlockedExchangeAdd( // NOLINT
|
|||
#pragma intrinsic(_InterlockedExchangeAdd)
|
||||
|
||||
#ifdef _WIN64
|
||||
extern "C" long long _InterlockedExchangeAdd64( // NOLINT
|
||||
long long volatile * Addend, long long Value); // NOLINT
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64)
|
||||
extern "C" void *_InterlockedCompareExchangePointer(
|
||||
void *volatile *Destination,
|
||||
void *Exchange, void *Comparand);
|
||||
|
@ -108,6 +111,19 @@ INLINE u32 atomic_fetch_add(volatile atomic_uint32_t *a,
|
|||
(volatile long*)&a->val_dont_use, (long)v); // NOLINT
|
||||
}
|
||||
|
||||
INLINE uptr atomic_fetch_add(volatile atomic_uintptr_t *a,
|
||||
uptr v, memory_order mo) {
|
||||
(void)mo;
|
||||
DCHECK(!((uptr)a % sizeof(*a)));
|
||||
#ifdef _WIN64
|
||||
return (uptr)_InterlockedExchangeAdd64(
|
||||
(volatile long long*)&a->val_dont_use, (long long)v); // NOLINT
|
||||
#else
|
||||
return (uptr)_InterlockedExchangeAdd(
|
||||
(volatile long*)&a->val_dont_use, (long)v); // NOLINT
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE u32 atomic_fetch_sub(volatile atomic_uint32_t *a,
|
||||
u32 v, memory_order mo) {
|
||||
(void)mo;
|
||||
|
@ -116,6 +132,19 @@ INLINE u32 atomic_fetch_sub(volatile atomic_uint32_t *a,
|
|||
(volatile long*)&a->val_dont_use, -(long)v); // NOLINT
|
||||
}
|
||||
|
||||
INLINE uptr atomic_fetch_sub(volatile atomic_uintptr_t *a,
|
||||
uptr v, memory_order mo) {
|
||||
(void)mo;
|
||||
DCHECK(!((uptr)a % sizeof(*a)));
|
||||
#ifdef _WIN64
|
||||
return (uptr)_InterlockedExchangeAdd64(
|
||||
(volatile long long*)&a->val_dont_use, -(long long)v); // NOLINT
|
||||
#else
|
||||
return (uptr)_InterlockedExchangeAdd(
|
||||
(volatile long*)&a->val_dont_use, -(long)v); // NOLINT
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE u8 atomic_exchange(volatile atomic_uint8_t *a,
|
||||
u8 v, memory_order mo) {
|
||||
(void)mo;
|
||||
|
|
Loading…
Reference in New Issue