mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-common: Introduce vkd3d_atomic_increment_u64().
This commit is contained in:
committed by
Alexandre Julliard
parent
c40093474e
commit
71decc927f
Notes:
Alexandre Julliard
2024-01-17 22:43:56 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/566
@@ -267,16 +267,28 @@ static inline int ascii_strcasecmp(const char *a, const char *b)
|
||||
return c_a - c_b;
|
||||
}
|
||||
|
||||
static inline uint64_t vkd3d_atomic_add_fetch_u64(uint64_t volatile *x, uint64_t val)
|
||||
{
|
||||
#if HAVE_SYNC_ADD_AND_FETCH
|
||||
return __sync_add_and_fetch(x, val);
|
||||
#elif defined(_WIN32)
|
||||
return InterlockedAdd64((LONG64 *)x, val);
|
||||
#else
|
||||
# error "vkd3d_atomic_add_fetch_u64() not implemented for this platform"
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint64_t vkd3d_atomic_increment_u64(uint64_t volatile *x)
|
||||
{
|
||||
return vkd3d_atomic_add_fetch_u64(x, 1);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
# if HAVE_SYNC_ADD_AND_FETCH
|
||||
static inline LONG InterlockedIncrement(LONG volatile *x)
|
||||
{
|
||||
return __sync_add_and_fetch(x, 1);
|
||||
}
|
||||
static inline LONG64 InterlockedIncrement64(LONG64 volatile *x)
|
||||
{
|
||||
return __sync_add_and_fetch(x, 1);
|
||||
}
|
||||
# else
|
||||
# error "InterlockedIncrement() not implemented for this platform"
|
||||
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||
|
Reference in New Issue
Block a user