24#ifndef OF_HAVE_ATOMIC_OPS
25# error No atomic operations available!
28#if !defined(OF_HAVE_THREADS)
30OFAtomicIntAdd(
volatile int *_Nonnull p,
int i)
35static OF_INLINE
void *_Nullable
36OFAtomicPointerAdd(
void *
volatile _Nullable *_Nonnull p, intptr_t i)
38 return (*(
char *
volatile *)p += i);
42OFAtomicIntSubtract(
volatile int *_Nonnull p,
int i)
47static OF_INLINE
void *_Nullable
48OFAtomicPointerSubtract(
void *
volatile _Nullable *_Nonnull p, intptr_t i)
50 return (*(
char *
volatile *)p -= i);
54OFAtomicIntIncrease(
volatile int *_Nonnull p)
60OFAtomicIntDecrease(
volatile int *_Nonnull p)
65static OF_INLINE
unsigned int
66OFAtomicIntOr(
volatile unsigned int *_Nonnull p,
unsigned int i)
71static OF_INLINE
unsigned int
72OFAtomicIntAnd(
volatile unsigned int *_Nonnull p,
unsigned int i)
78OFAtomicIntCompareAndSwap(
volatile int *_Nonnull p,
int o,
int n)
89OFAtomicPointerCompareAndSwap(
void *
volatile _Nullable *_Nonnull p,
90 void *_Nullable o,
void *_Nullable n)
107OFAcquireMemoryBarrier(
void)
113OFReleaseMemoryBarrier(
void)
117#elif (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__)
118# import "platform/x86/OFAtomic.h"
119#elif defined(OF_POWERPC) && defined(__GNUC__) && !defined(__APPLE_CC__) && \
121# import "platform/PowerPC/OFAtomic.h"
122#elif defined(OF_HAVE_ATOMIC_BUILTINS)
123# import "platform/GCC4.7/OFAtomic.h"
124#elif defined(OF_HAVE_SYNC_BUILTINS)
125# import "platform/GCC4/OFAtomic.h"
126#elif defined(OF_HAVE_OSATOMIC)
127# import "platform/macOS/OFAtomic.h"
129# error No atomic operations available!