Index: third_party/harfbuzz-ng/src/hb-atomic-private.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-atomic-private.hh b/third_party/harfbuzz-ng/src/hb-atomic-private.hh |
index 9cc3bc5587c89fe6480b5adea8aa54d5c51bace7..1c4e1202ec6f0079c275156caf2f7cc988f4ccb0 100644 |
--- a/third_party/harfbuzz-ng/src/hb-atomic-private.hh |
+++ b/third_party/harfbuzz-ng/src/hb-atomic-private.hh |
@@ -47,18 +47,22 @@ |
#define WIN32_LEAN_AND_MEAN |
#include <windows.h> |
-#if defined(__MINGW32__) && !defined(MemoryBarrier) |
+/* MinGW has a convoluted history of supporting MemoryBarrier |
+ * properly. As such, define a function to wrap the whole |
+ * thing. */ |
static inline void _HBMemoryBarrier (void) { |
+#if !defined(MemoryBarrier) |
long dummy = 0; |
InterlockedExchange (&dummy, 1); |
-} |
-# define MemoryBarrier _HBMemoryBarrier |
+#else |
+ MemoryBarrier (); |
#endif |
+} |
typedef LONG hb_atomic_int_t; |
#define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V)) |
-#define hb_atomic_ptr_get(P) (MemoryBarrier (), (void *) *(P)) |
+#define hb_atomic_ptr_get(P) (_HBMemoryBarrier (), (void *) *(P)) |
#define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O)) |
@@ -78,7 +82,7 @@ typedef int32_t hb_atomic_int_t; |
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100) |
#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P)) |
#else |
-#if __ppc64__ || __x86_64__ |
+#if __ppc64__ || __x86_64__ || __arm64__ |
#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P)) |
#else |
#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P)) |