Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-atomic-private.hh

Issue 1580513002: Roll HarfBuzz to 1.1.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/harfbuzz-ng/src/hb.h ('k') | third_party/harfbuzz-ng/src/hb-blob.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #include <mbarrier.h> 112 #include <mbarrier.h>
113 113
114 typedef unsigned int hb_atomic_int_impl_t; 114 typedef unsigned int hb_atomic_int_impl_t;
115 #define HB_ATOMIC_INT_IMPL_INIT(V) (V) 115 #define HB_ATOMIC_INT_IMPL_INIT(V) (V)
116 #define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V)) 116 #define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
117 117
118 #define hb_atomic_ptr_impl_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P)) 118 #define hb_atomic_ptr_impl_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P))
119 #define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? tru e : false) 119 #define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? tru e : false)
120 120
121 121
122 #elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
123
124 #include <builtins.h>
125
126
127 static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) {
128 __lwsync();
129 int result = __fetch_and_add(AI, V);
130 __isync();
131 return result;
132 }
133 static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
134 __sync();
135 int result = __compare_and_swaplp (P, &O, N);
136 __sync();
137 return result;
138 }
139
140 typedef int hb_atomic_int_impl_t;
141 #define HB_ATOMIC_INT_IMPL_INIT(V) (V)
142 #define hb_atomic_int_impl_add(AI, V) hb_fetch_and_add (&(AI), (V))
143
144 #define hb_atomic_ptr_impl_get(P) (__sync(), (void *) *(P))
145 #define hb_atomic_ptr_impl_cmpexch(P,O,N) hb_compare_and_swaplp ((long*)(P ), (long)(O), (long)(N))
146
122 #elif !defined(HB_NO_MT) 147 #elif !defined(HB_NO_MT)
123 148
124 #define HB_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */ 149 #define HB_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
125 150
126 typedef volatile int hb_atomic_int_impl_t; 151 typedef volatile int hb_atomic_int_impl_t;
127 #define HB_ATOMIC_INT_IMPL_INIT(V) (V) 152 #define HB_ATOMIC_INT_IMPL_INIT(V) (V)
128 #define hb_atomic_int_impl_add(AI, V) (((AI) += (V)) - (V)) 153 #define hb_atomic_int_impl_add(AI, V) (((AI) += (V)) - (V))
129 154
130 #define hb_atomic_ptr_impl_get(P) ((void *) *(P)) 155 #define hb_atomic_ptr_impl_get(P) ((void *) *(P))
131 #define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void * volatile *) (P) == (v oid *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false) 156 #define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void * volatile *) (P) == (v oid *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
(...skipping 23 matching lines...) Expand all
155 inline int inc (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_in t_impl_t &> (v), 1); } 180 inline int inc (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_in t_impl_t &> (v), 1); }
156 inline int dec (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_in t_impl_t &> (v), -1); } 181 inline int dec (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_in t_impl_t &> (v), -1); }
157 }; 182 };
158 183
159 184
160 #define hb_atomic_ptr_get(P) hb_atomic_ptr_impl_get(P) 185 #define hb_atomic_ptr_get(P) hb_atomic_ptr_impl_get(P)
161 #define hb_atomic_ptr_cmpexch(P,O,N) hb_atomic_ptr_impl_cmpexch((P),(O),(N)) 186 #define hb_atomic_ptr_cmpexch(P,O,N) hb_atomic_ptr_impl_cmpexch((P),(O),(N))
162 187
163 188
164 #endif /* HB_ATOMIC_PRIVATE_HH */ 189 #endif /* HB_ATOMIC_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb.h ('k') | third_party/harfbuzz-ng/src/hb-blob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698