summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-12-01 07:58:12 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-12-02 07:46:53 +0000
commite82ca698ecdf7f73f6d0bf2974c19beade0f09cc (patch)
treea45ccf516783877385f6ece2baca7cca2c5113d4
parent06e32106cc4c0886c228b4dbfe7301222a96a231 (diff)
use compiler intrinsic for osl_atomic_increment on Windows
Change-Id: I66b2ba5d8e419f6af5eb3f85f8c12effcdaf4d5e Reviewed-on: https://gerrit.libreoffice.org/20319 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--include/osl/interlck.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/osl/interlck.h b/include/osl/interlck.h
index 925e5f298e3a..85da29810446 100644
--- a/include/osl/interlck.h
+++ b/include/osl/interlck.h
@@ -25,6 +25,10 @@
#include <sal/saldllapi.h>
#include <sal/types.h>
+#if defined WNT
+#include <intrin.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -58,6 +62,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte
*/
#if HAVE_GCC_BUILTIN_ATOMIC
# define osl_atomic_increment(p) __sync_add_and_fetch((p), 1)
+#elif defined WNT
+# define osl_atomic_increment(p) _InterlockedIncrement(p)
#else
# define osl_atomic_increment(p) osl_incrementInterlockedCount((p))
#endif
@@ -75,6 +81,8 @@ SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInte
*/
#if HAVE_GCC_BUILTIN_ATOMIC
# define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
+#elif defined WNT
+# define osl_atomic_decrement(p) _InterlockedDecrement(p)
#else
# define osl_atomic_decrement(p) osl_decrementInterlockedCount((p))
#endif