[Libreoffice-commits] .: sal/osl

Michael Meeks mmeeks at kemper.freedesktop.org
Fri Jan 28 07:04:46 PST 2011


 sal/osl/unx/interlck.c |   37 +++----------------------------------
 1 file changed, 3 insertions(+), 34 deletions(-)

New commits:
commit 788072cefdce8cb61d46549a7aede4c754d9fae3
Author: Jani Monoses <jani.monoses at canonical.com>
Date:   Fri Jan 28 15:04:26 2011 +0000

    use gcc builtins for POWERPC and ARM cases if we have GCC

diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c
index f164371..d339f21 100644
--- a/sal/osl/unx/interlck.c
+++ b/sal/osl/unx/interlck.c
@@ -94,47 +94,16 @@ oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount*
     return --nCount;
 }
 
-#elif defined ( GCC ) && defined ( POWERPC ) && !defined( AIX )
-
-/*****************************************************************************/
-/* osl_incrementInterlockedCount */
-/*****************************************************************************/
+#elif defined ( GCC )
 oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount)
 {
-    /* "addi" doesn't work with r0 as second parameter */
-    register oslInterlockedCount nCount __asm__ ("r4");
-
-    __asm__ __volatile__ (
-        "1: lwarx   %0,0,%2\n\t"
-        "   addi    %0,%0,1\n\t"
-        "   stwcx.  %0,0,%2\n\t"
-        "   bne-    1b\n\t"
-        "   isync"
-        : "=&r" (nCount), "=m" (*pCount)
-        : "r" (pCount)
-        : "memory");
-
-    return nCount;
+    return __sync_add_and_fetch(pCount, 1);
 }
 
 oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount)
 {
-    /* "subi" doesn't work with r0 as second parameter */
-    register oslInterlockedCount nCount __asm__ ("r4");
-
-    __asm__ __volatile__ (
-        "1: lwarx   %0,0,%2\n\t"
-        "   subi    %0,%0,1\n\t"
-        "   stwcx.  %0,0,%2\n\t"
-        "   bne-    1b\n\t"
-        "   isync"
-        : "=&r" (nCount), "=m" (*pCount)
-        : "r" (pCount)
-        : "memory");
-
-    return nCount;
+    return __sync_sub_and_fetch(pCount, 1);
 }
-
 #else
 /* use only if nothing else works, expensive due to single mutex for all reference counts */
 


More information about the Libreoffice-commits mailing list