mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 04:30:45 +02:00
Update OpenAL Soft to commit 414b56edec5441211dc924fef365c54267c04f1c
This commit is contained in:
@@ -4,6 +4,19 @@
|
||||
#include "static_assert.h"
|
||||
#include "bool.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* This helps cast away the const-ness of a pointer without accidentally
|
||||
* changing the pointer type. This is necessary due to Clang's inability to use
|
||||
* atomic_load on a const _Atomic variable.
|
||||
*/
|
||||
#define CONST_CAST(T, V) __extension__({ \
|
||||
const T _tmp = (V); \
|
||||
(T)_tmp; \
|
||||
})
|
||||
#else
|
||||
#define CONST_CAST(T, V) ((T)(V))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -293,6 +306,7 @@ enum almemory_order {
|
||||
} while(0)
|
||||
|
||||
int _al_invalid_atomic_size(); /* not defined */
|
||||
void *_al_invalid_atomic_ptr_size(); /* not defined */
|
||||
|
||||
#define ATOMIC_ADD(_val, _incr, _MO) \
|
||||
((sizeof((_val)->value)==4) ? WRAP_ADDSUB(LONG, AtomicAdd32, &(_val)->value, (_incr)) : \
|
||||
@@ -314,7 +328,7 @@ int _al_invalid_atomic_size(); /* not defined */
|
||||
|
||||
#define ATOMIC_EXCHANGE_PTR(_val, _newval, _MO) \
|
||||
((sizeof((_val)->value)==sizeof(void*)) ? AtomicSwapPtr((void*volatile*)&(_val)->value, (_newval)) : \
|
||||
(void*)_al_invalid_atomic_size())
|
||||
_al_invalid_atomic_ptr_size())
|
||||
#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, _MO1, _MO2)\
|
||||
((sizeof((_val)->value)==sizeof(void*)) ? CompareAndSwapPtr((void*volatile*)&(_val)->value, (_newval), (void**)(_oldval)) : \
|
||||
(bool)_al_invalid_atomic_size())
|
||||
@@ -399,11 +413,11 @@ typedef ATOMIC(uint) RefCount;
|
||||
inline void InitRef(RefCount *ptr, uint value)
|
||||
{ ATOMIC_INIT(ptr, value); }
|
||||
inline uint ReadRef(RefCount *ptr)
|
||||
{ return ATOMIC_LOAD_SEQ(ptr); }
|
||||
{ return ATOMIC_LOAD(ptr, almemory_order_acquire); }
|
||||
inline uint IncrementRef(RefCount *ptr)
|
||||
{ return ATOMIC_ADD_SEQ(ptr, 1)+1; }
|
||||
{ return ATOMIC_ADD(ptr, 1, almemory_order_acq_rel)+1; }
|
||||
inline uint DecrementRef(RefCount *ptr)
|
||||
{ return ATOMIC_SUB_SEQ(ptr, 1)-1; }
|
||||
{ return ATOMIC_SUB(ptr, 1, almemory_order_acq_rel)-1; }
|
||||
|
||||
|
||||
/* WARNING: A livelock is theoretically possible if another thread keeps
|
||||
|
||||
Reference in New Issue
Block a user