equal
deleted
inserted
replaced
230 return old_value; |
230 return old_value; |
231 } |
231 } |
232 |
232 |
233 template<> |
233 template<> |
234 template<typename T> |
234 template<typename T> |
235 inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, |
235 inline T Atomic::PlatformCmpxchg<1>::operator()(T volatile* dest, |
236 T volatile* dest, |
|
237 T compare_value, |
236 T compare_value, |
|
237 T exchange_value, |
238 atomic_memory_order order) const { |
238 atomic_memory_order order) const { |
239 STATIC_ASSERT(1 == sizeof(T)); |
239 STATIC_ASSERT(1 == sizeof(T)); |
240 |
240 |
241 // Note that cmpxchg guarantees a two-way memory barrier across |
241 // Note that cmpxchg guarantees a two-way memory barrier across |
242 // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not |
242 // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not |
300 return PrimitiveConversions::cast<T>((unsigned char)old_value); |
300 return PrimitiveConversions::cast<T>((unsigned char)old_value); |
301 } |
301 } |
302 |
302 |
303 template<> |
303 template<> |
304 template<typename T> |
304 template<typename T> |
305 inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, |
305 inline T Atomic::PlatformCmpxchg<4>::operator()(T volatile* dest, |
306 T volatile* dest, |
|
307 T compare_value, |
306 T compare_value, |
|
307 T exchange_value, |
308 atomic_memory_order order) const { |
308 atomic_memory_order order) const { |
309 STATIC_ASSERT(4 == sizeof(T)); |
309 STATIC_ASSERT(4 == sizeof(T)); |
310 |
310 |
311 // Note that cmpxchg guarantees a two-way memory barrier across |
311 // Note that cmpxchg guarantees a two-way memory barrier across |
312 // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not |
312 // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not |
350 return old_value; |
350 return old_value; |
351 } |
351 } |
352 |
352 |
353 template<> |
353 template<> |
354 template<typename T> |
354 template<typename T> |
355 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, |
355 inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest, |
356 T volatile* dest, |
|
357 T compare_value, |
356 T compare_value, |
|
357 T exchange_value, |
358 atomic_memory_order order) const { |
358 atomic_memory_order order) const { |
359 STATIC_ASSERT(8 == sizeof(T)); |
359 STATIC_ASSERT(8 == sizeof(T)); |
360 |
360 |
361 // Note that cmpxchg guarantees a two-way memory barrier across |
361 // Note that cmpxchg guarantees a two-way memory barrier across |
362 // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not |
362 // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not |