summaryrefslogtreecommitdiffstats
path: root/include/internal/refcount.h
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2019-09-18 15:26:19 +1000
committerShane Lontis <shane.lontis@oracle.com>2019-09-18 15:26:19 +1000
commitecae0575103918868b29cc11aa35e3b91fe7dcc8 (patch)
treeeb8631b76be26c7f599bcafa2797fc6b4d07e0e3 /include/internal/refcount.h
parent793374c82abd3215ec33d989810214a871849eda (diff)
Fix Compiler error/warning for windows icl build
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9907)
Diffstat (limited to 'include/internal/refcount.h')
-rw-r--r--include/internal/refcount.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/internal/refcount.h b/include/internal/refcount.h
index eddf12415f..1619b28932 100644
--- a/include/internal/refcount.h
+++ b/include/internal/refcount.h
@@ -73,6 +73,21 @@ static __inline__ int CRYPTO_DOWN_REF(int *val, int *ret, void *lock)
__atomic_thread_fence(__ATOMIC_ACQUIRE);
return 1;
}
+# elif defined(__ICL) && defined(_WIN32)
+# define HAVE_ATOMICS 1
+typedef volatile int CRYPTO_REF_COUNT;
+
+static __inline int CRYPTO_UP_REF(volatile int *val, int *ret, void *lock)
+{
+ *ret = _InterlockedExchangeAdd((void *)val, 1) + 1;
+ return 1;
+}
+
+static __inline int CRYPTO_DOWN_REF(volatile int *val, int *ret, void *lock)
+{
+ *ret = _InterlockedExchangeAdd((void *)val, -1) - 1;
+ return 1;
+}
# elif defined(_MSC_VER) && _MSC_VER>=1200