Kaydet (Commit) e82ca698 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

use compiler intrinsic for osl_atomic_increment on Windows

Change-Id: I66b2ba5d8e419f6af5eb3f85f8c12effcdaf4d5e
Reviewed-on: https://gerrit.libreoffice.org/20319Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 06e32106
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include <sal/saldllapi.h> #include <sal/saldllapi.h>
#include <sal/types.h> #include <sal/types.h>
#if defined WNT
#include <intrin.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -58,6 +62,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte ...@@ -58,6 +62,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte
*/ */
#if HAVE_GCC_BUILTIN_ATOMIC #if HAVE_GCC_BUILTIN_ATOMIC
# define osl_atomic_increment(p) __sync_add_and_fetch((p), 1) # define osl_atomic_increment(p) __sync_add_and_fetch((p), 1)
#elif defined WNT
# define osl_atomic_increment(p) _InterlockedIncrement(p)
#else #else
# define osl_atomic_increment(p) osl_incrementInterlockedCount((p)) # define osl_atomic_increment(p) osl_incrementInterlockedCount((p))
#endif #endif
...@@ -75,6 +81,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte ...@@ -75,6 +81,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte
*/ */
#if HAVE_GCC_BUILTIN_ATOMIC #if HAVE_GCC_BUILTIN_ATOMIC
# define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1) # define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
#elif defined WNT
# define osl_atomic_decrement(p) _InterlockedDecrement(p)
#else #else
# define osl_atomic_decrement(p) osl_decrementInterlockedCount((p)) # define osl_atomic_decrement(p) osl_decrementInterlockedCount((p))
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment