summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-08-01 02:40:25 -0700
committerChris Robinson <[email protected]>2014-08-01 02:40:25 -0700
commit1c1e878be75d9fae097dab56766ce51229f68477 (patch)
tree7214822a43426eae0052d1ef3d80712b3ea0cd8b
parent87423f046e378ec5c126cacb808dbc600481dcbd (diff)
Add some casts for inline assembly atomics
And remove an unnecessary void cast
-rw-r--r--OpenAL32/alError.c2
-rw-r--r--include/atomic.h12
2 files changed, 7 insertions, 7 deletions
diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c
index 875e118a..9369af56 100644
--- a/OpenAL32/alError.c
+++ b/OpenAL32/alError.c
@@ -46,7 +46,7 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
raise(SIGTRAP);
#endif
}
- (void)ATOMIC_COMPARE_EXCHANGE_STRONG(ALenum, &Context->LastError, &curerr, errorCode);
+ ATOMIC_COMPARE_EXCHANGE_STRONG(ALenum, &Context->LastError, &curerr, errorCode);
}
AL_API ALenum AL_APIENTRY alGetError(void)
diff --git a/include/atomic.h b/include/atomic.h
index 5fd76252..3cde46df 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -153,14 +153,14 @@ inline void *ExchangePtr(XchgPtr *dest, void *newval)
static_assert(sizeof(T)==4, "Type "#T" has incorrect size!"); \
static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \
T _r; \
- WRAP_ADD(_r, &(_val)->value, (_incr)); \
+ WRAP_ADD(_r, &(_val)->value, (T)(_incr)); \
_r; \
})
#define ATOMIC_SUB(T, _val, _decr) __extension__({ \
static_assert(sizeof(T)==4, "Type "#T" has incorrect size!"); \
static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \
T _r; \
- WRAP_SUB(_r, &(_val)->value, (_decr)); \
+ WRAP_SUB(_r, &(_val)->value, (T)(_decr)); \
_r; \
})
@@ -168,16 +168,16 @@ inline void *ExchangePtr(XchgPtr *dest, void *newval)
static_assert(sizeof(T)==4 || sizeof(T)==8, "Type "#T" has incorrect size!"); \
static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \
T _r; \
- if(sizeof(T) == 4) WRAP_XCHG("l", _r, &(_val)->value, (_newval)); \
- else if(sizeof(T) == 8) WRAP_XCHG("q", _r, &(_val)->value, (_newval)); \
+ if(sizeof(T) == 4) WRAP_XCHG("l", _r, &(_val)->value, (T)(_newval)); \
+ else if(sizeof(T) == 8) WRAP_XCHG("q", _r, &(_val)->value, (T)(_newval)); \
_r; \
})
#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval) __extension__({ \
static_assert(sizeof(T)==4 || sizeof(T)==8, "Type "#T" has incorrect size!"); \
static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \
__typeof(*_oldval) _old = *(_oldval); \
- if(sizeof(T) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (_newval)); \
- else if(sizeof(T) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (_newval)); \
+ if(sizeof(T) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (T)(_newval)); \
+ else if(sizeof(T) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (T)(_newval)); \
*(_oldval) == _old; \
})