[Libreoffice-commits] .: sal/inc

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 24 18:56:52 PDT 2012


 sal/inc/osl/interlck.h |    4 ++++
 sal/inc/sal/config.h   |    2 ++
 2 files changed, 6 insertions(+)

New commits:
commit 5ae27819974e3492b6f4d33fa51ef2a9d77b5ce5
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Sep 22 04:38:32 2012 -0500

    use intrinsict to inline InterlockCount() on Windows too
    
    Change-Id: I93949cc37821c5306514c8ce2f21519550f33775
    Reviewed-on: https://gerrit.libreoffice.org/672
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/sal/inc/osl/interlck.h b/sal/inc/osl/interlck.h
index 792ea55..22ff985 100644
--- a/sal/inc/osl/interlck.h
+++ b/sal/inc/osl/interlck.h
@@ -67,6 +67,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte
 */
 #if defined( HAVE_GCC_BUILTIN_ATOMIC )
 #    define osl_atomic_increment(p)  __sync_add_and_fetch((p), 1)
+#elif defined( _MSC_VER )
+#    define osl_atomic_increment(p) _InterlockedIncrement((p))
 #else
 #    define osl_atomic_increment(p) osl_incrementInterlockedCount((p))
 #endif
@@ -84,6 +86,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte
 */
 #if defined( HAVE_GCC_BUILTIN_ATOMIC )
 #    define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
+#elif defined( _MSC_VER )
+#    define osl_atomic_decrement(p) _InterlockedDecrement((p))
 #else
 #    define osl_atomic_decrement(p) osl_decrementInterlockedCount((p))
 #endif
diff --git a/sal/inc/sal/config.h b/sal/inc/sal/config.h
index aee8e82..e81250a 100644
--- a/sal/inc/sal/config.h
+++ b/sal/inc/sal/config.h
@@ -44,6 +44,8 @@
 
 #ifdef _MSC_VER
 
+#include <Intrin.h> // define intrinsic functions supported by the compiler
+
 #ifndef _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES // needed by Visual C++ for math constants
 #endif


More information about the Libreoffice-commits mailing list