First draft of atomic operations code for GCC and linux.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403668
This commit is contained in:
parent
386dceedb4
commit
bd15ea1fd5
1 changed files with 25 additions and 26 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue