From 7030a52f2ea199df4f83b1292b5c1a3ddce98275 Mon Sep 17 00:00:00 2001 From: tilghman Date: Sun, 9 Sep 2007 02:35:18 +0000 Subject: Fix inline compiles on really old compilers (who uses gcc 2.7 anymore, really?) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@82028 f38db490-d61c-443f-a65b-d21fe96a405b --- include/asterisk/lock.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'include/asterisk/lock.h') diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index eea145acf..b8eeeb33c 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -786,19 +786,27 @@ AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), { return OSAtomicAdd64(v, (int64_t *) p); #elif defined (__i386__) +#ifdef sun AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), { __asm __volatile ( -#ifdef sun " lock; xaddl %0, %1 ; " -#else + : "+r" (v), /* 0 (result) */ + "=m" (*p) /* 1 */ + : "m" (*p)); /* 2 */ + return (v); +}) +#else /* ifndef sun */ +AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), +{ + __asm __volatile ( " lock xaddl %0, %1 ; " -#endif : "+r" (v), /* 0 (result) */ "=m" (*p) /* 1 */ : "m" (*p)); /* 2 */ return (v); }) +#endif #else /* low performance version in utils.c */ AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), { -- cgit v1.2.3