diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-22 04:38:32 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-25 01:56:33 +0000 |
commit | 5ae27819974e3492b6f4d33fa51ef2a9d77b5ce5 (patch) | |
tree | 5dad352f858e4beed36aa0121a5b1746e73d394e /sal | |
parent | 750fc206113a796035cbc05fb904fbae0eb771a8 (diff) |
use intrinsict to inline InterlockCount() on Windows too
Change-Id: I93949cc37821c5306514c8ce2f21519550f33775
Reviewed-on: https://gerrit.libreoffice.org/672
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/osl/interlck.h | 4 | ||||
-rw-r--r-- | sal/inc/sal/config.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sal/inc/osl/interlck.h b/sal/inc/osl/interlck.h index 792ea55051d9..22ff98504eae 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 aee8e829067b..e81250ac0351 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 |