mirror of
https://github.com/yawut/SDL.git
synced 2026-07-29 22:48:48 -05:00
First draft of atomic operations code for GCC and linux.
This commit is contained in:
parent
0b5bc4d23b
commit
c0646fda71
|
|
@ -29,148 +29,147 @@
|
|||
Uint32
|
||||
SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_lock_test_and_set(ptr, value);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
|
||||
{
|
||||
return SDL_false;
|
||||
return (SDL_bool)__sync_bool_compare_and_swap(ptr, oldvalue, newvalue);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicTestThenSet32(Uint32 * ptr)
|
||||
{
|
||||
return SDL_false;
|
||||
return (SDL_bool)(0 == __sync_lock_test_and_set(ptr, 1));
|
||||
}
|
||||
|
||||
void
|
||||
SDL_AtomicClear32(Uint32 * ptr)
|
||||
{
|
||||
__sync_lock_release(ptr);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicFetchThenIncrement32(Uint32 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_add(ptr, 1);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicFetchThenDecrement32(Uint32 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_sub(ptr, 1);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_add(ptr, value);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_sub(ptr, value);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicIncrementThenFetch32(Uint32 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_add_and_fetch(ptr, 1);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicDecrementThenFetch32(Uint32 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_sub_and_fetch(ptr, 1);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_add_and_fetch(ptr, value);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_sub_and_fetch(ptr, value);
|
||||
}
|
||||
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
|
||||
Uint64
|
||||
SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_lock_test_and_set(ptr, value);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCompareThenSet64(Uint64 * ptr,
|
||||
Uint64 oldvalue, Uint64 newvalue)
|
||||
SDL_AtomicCompareThenSet64(Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue)
|
||||
{
|
||||
return SDL_false;
|
||||
return (SDL_bool)__sync_bool_compare_and_swap(ptr, oldvalue, newvalue);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicTestThenSet64(Uint64 * ptr)
|
||||
{
|
||||
return SDL_false;
|
||||
return (SDL_bool)(0 == __sync_lock_test_and_set(ptr, 1));
|
||||
}
|
||||
|
||||
void
|
||||
SDL_AtomicClear64(Uint64 * ptr)
|
||||
{
|
||||
__sync_lock_release(ptr);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicFetchThenIncrement64(Uint64 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_add(ptr, 1);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicFetchThenDecrement64(Uint64 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_sub(ptr, 1);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_add(ptr, value);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_fetch_and_sub(ptr, value);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicIncrementThenFetch64(Uint64 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_add_and_fetch(ptr, 1);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicDecrementThenFetch64(Uint64 * ptr)
|
||||
{
|
||||
return 0;
|
||||
return __sync_sub_and_fetch(ptr, 1);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_add_and_fetch(ptr, value);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value)
|
||||
{
|
||||
return 0;
|
||||
return __sync_sub_and_fetch(ptr, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user