mirror of https://github.com/mgba-emu/mgba.git
Util: Fix some macro best practices
This commit is contained in:
parent
e470795258
commit
4e85de3a42
|
@ -110,13 +110,13 @@ typedef intptr_t ssize_t;
|
||||||
#define ATOMIC_LOAD_PTR(DST, SRC) DST = InterlockedCompareExchangePointer(&SRC, 0, 0)
|
#define ATOMIC_LOAD_PTR(DST, SRC) DST = InterlockedCompareExchangePointer(&SRC, 0, 0)
|
||||||
#else
|
#else
|
||||||
// TODO
|
// TODO
|
||||||
#define ATOMIC_STORE(DST, SRC) DST = SRC
|
#define ATOMIC_STORE(DST, SRC) ((DST) = (SRC))
|
||||||
#define ATOMIC_LOAD(DST, SRC) DST = SRC
|
#define ATOMIC_LOAD(DST, SRC) ((DST) = (SRC))
|
||||||
#define ATOMIC_ADD(DST, OP) DST += OP
|
#define ATOMIC_ADD(DST, OP) ((DST) += (OP))
|
||||||
#define ATOMIC_SUB(DST, OP) DST -= OP
|
#define ATOMIC_SUB(DST, OP) ((DST) -= (OP))
|
||||||
#define ATOMIC_OR(DST, OP) DST |= OP
|
#define ATOMIC_OR(DST, OP) ((DST) |= (OP))
|
||||||
#define ATOMIC_AND(DST, OP) DST &= OP
|
#define ATOMIC_AND(DST, OP) ((DST) &= (OP))
|
||||||
#define ATOMIC_CMPXCHG(DST, EXPECTED, OP) ((DST == EXPECTED) ? ((DST = OP), true) : false)
|
#define ATOMIC_CMPXCHG(DST, EXPECTED, OP) (((DST) == (EXPECTED)) ? (((DST) = (OP)), true) : false)
|
||||||
#define ATOMIC_STORE_PTR(DST, SRC) ATOMIC_STORE(DST, SRC)
|
#define ATOMIC_STORE_PTR(DST, SRC) ATOMIC_STORE(DST, SRC)
|
||||||
#define ATOMIC_LOAD_PTR(DST, SRC) ATOMIC_LOAD(DST, SRC)
|
#define ATOMIC_LOAD_PTR(DST, SRC) ATOMIC_LOAD(DST, SRC)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue