mirror of https://github.com/encounter/SDL.git
fix SOLARIS_ATOMICS
- use 'sizeless' int types (int uses 32-bit even if _LP64 is set)
This commit is contained in:
parent
b095df7f5c
commit
e5c599f8c6
|
@ -136,10 +136,8 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
|
||||||
return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
|
return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
|
||||||
#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
|
#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
|
||||||
return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
|
return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
|
||||||
#elif defined(__SOLARIS__) && defined(_LP64)
|
#elif defined(__SOLARIS__)
|
||||||
return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval);
|
return (SDL_bool) ((int) atomic_cas_uint((volatile uint_t*)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
|
||||||
#elif defined(__SOLARIS__) && !defined(_LP64)
|
|
||||||
return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)&a->value, (uint32_t)oldval, (uint32_t)newval) == oldval);
|
|
||||||
#elif EMULATE_CAS
|
#elif EMULATE_CAS
|
||||||
SDL_bool retval = SDL_FALSE;
|
SDL_bool retval = SDL_FALSE;
|
||||||
|
|
||||||
|
@ -197,10 +195,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||||
return _SDL_xchg_watcom(&a->value, v);
|
return _SDL_xchg_watcom(&a->value, v);
|
||||||
#elif defined(HAVE_GCC_ATOMICS)
|
#elif defined(HAVE_GCC_ATOMICS)
|
||||||
return __sync_lock_test_and_set(&a->value, v);
|
return __sync_lock_test_and_set(&a->value, v);
|
||||||
#elif defined(__SOLARIS__) && defined(_LP64)
|
#elif defined(__SOLARIS__)
|
||||||
return (int) atomic_swap_64((volatile uint64_t*)&a->value, (uint64_t)v);
|
return (int) atomic_swap_uint((volatile uint_t*)&a->value, v);
|
||||||
#elif defined(__SOLARIS__) && !defined(_LP64)
|
|
||||||
return (int) atomic_swap_32((volatile uint32_t*)&a->value, (uint32_t)v);
|
|
||||||
#else
|
#else
|
||||||
int value;
|
int value;
|
||||||
do {
|
do {
|
||||||
|
@ -241,13 +237,9 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||||
#elif defined(HAVE_GCC_ATOMICS)
|
#elif defined(HAVE_GCC_ATOMICS)
|
||||||
return __sync_fetch_and_add(&a->value, v);
|
return __sync_fetch_and_add(&a->value, v);
|
||||||
#elif defined(__SOLARIS__)
|
#elif defined(__SOLARIS__)
|
||||||
int pv = a->value;
|
int pv = a->value;
|
||||||
membar_consumer();
|
membar_consumer();
|
||||||
#if defined(_LP64)
|
atomic_add_int((volatile uint_t*)&a->value, v);
|
||||||
atomic_add_64((volatile uint64_t*)&a->value, v);
|
|
||||||
#elif !defined(_LP64)
|
|
||||||
atomic_add_32((volatile uint32_t*)&a->value, v);
|
|
||||||
#endif
|
|
||||||
return pv;
|
return pv;
|
||||||
#else
|
#else
|
||||||
int value;
|
int value;
|
||||||
|
|
Loading…
Reference in New Issue