mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Tweak atomic inc/dec code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33116 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
794bd55f57
commit
e4e38170f9
1 changed files with 8 additions and 3 deletions
|
@ -226,12 +226,15 @@ typedef int32_t volatile *gsatomic_t;
|
|||
|
||||
#define GSATOMICREAD(X) (*(X))
|
||||
|
||||
#ifdef ATOMICTEST
|
||||
#define ATOMIC_TESTING 1
|
||||
|
||||
#if defined(ATOMIC_TESTING)
|
||||
static __inline__ int
|
||||
GSAtomicIncrement(gsatomic_t X)
|
||||
{
|
||||
int32_t tmp = 1;
|
||||
register int tmp;
|
||||
__asm__ __volatile__ (
|
||||
"movl $1, %0\n\t"
|
||||
"lock xaddl %0, %1"
|
||||
:"=r" (tmp), "=m" (*X)
|
||||
:"r" (tmp), "m" (*X)
|
||||
|
@ -242,8 +245,10 @@ GSAtomicIncrement(gsatomic_t X)
|
|||
static __inline__ int
|
||||
GSAtomicDecrement(gsatomic_t X)
|
||||
{
|
||||
int32_t tmp = -1;
|
||||
register int tmp;
|
||||
__asm__ __volatile__ (
|
||||
"movl $1, %0\n\t"
|
||||
"negl %0\n\t"
|
||||
"lock xaddl %0, %1"
|
||||
:"=r" (tmp), "=m" (*X)
|
||||
:"r" (tmp), "m" (*X)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue