OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2007 Chris Wilson | 2 * Copyright © 2007 Chris Wilson |
3 * Copyright © 2009,2010 Red Hat, Inc. | 3 * Copyright © 2009,2010 Red Hat, Inc. |
4 * Copyright © 2011,2012 Google, Inc. | 4 * Copyright © 2011,2012 Google, Inc. |
5 * | 5 * |
6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
7 * | 7 * |
8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include <Availability.h> | 75 #include <Availability.h> |
76 #endif | 76 #endif |
77 | 77 |
78 typedef int32_t hb_atomic_int_t; | 78 typedef int32_t hb_atomic_int_t; |
79 #define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V)
) | 79 #define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V)
) |
80 | 80 |
81 #define hb_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P)) | 81 #define hb_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P)) |
82 #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_M
IN_REQUIRED >= 20100) | 82 #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_M
IN_REQUIRED >= 20100) |
83 #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void
*) (O), (void *) (N), (void **) (P)) | 83 #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void
*) (O), (void *) (N), (void **) (P)) |
84 #else | 84 #else |
85 #if __ppc64__ || __x86_64__ || __arm64__ | 85 #if __ppc64__ || __x86_64__ || __aarch64__ |
86 #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_
t) (O), (int64_t) (N), (int64_t*) (P)) | 86 #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_
t) (O), (int64_t) (N), (int64_t*) (P)) |
87 #else | 87 #else |
88 #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_
t) (O), (int32_t) (N), (int32_t*) (P)) | 88 #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_
t) (O), (int32_t) (N), (int32_t*) (P)) |
89 #endif | 89 #endif |
90 #endif | 90 #endif |
91 | 91 |
92 | 92 |
93 #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) | 93 #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) |
94 | 94 |
95 typedef int hb_atomic_int_t; | 95 typedef int hb_atomic_int_t; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) | 127 #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) |
128 | 128 |
129 #define hb_atomic_ptr_get(P) ((void *) *(P)) | 129 #define hb_atomic_ptr_get(P) ((void *) *(P)) |
130 #define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (v
oid **) (P) = (void *) (N), true) : false) | 130 #define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (v
oid **) (P) = (void *) (N), true) : false) |
131 | 131 |
132 #endif | 132 #endif |
133 | 133 |
134 /* TODO Add tracing. */ | 134 /* TODO Add tracing. */ |
135 | 135 |
136 #endif /* HB_ATOMIC_PRIVATE_HH */ | 136 #endif /* HB_ATOMIC_PRIVATE_HH */ |
OLD | NEW |