File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -322,20 +322,28 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
322322 atomic_ref& operator =(const atomic_ref&) = delete ;
323323
324324 _LIBCPP_HIDE_FROM_ABI _Tp fetch_add (_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
325+ # ifdef _LIBCPP_COMPILER_CLANG_BASED
326+ return __atomic_fetch_add (this ->__ptr_ , __arg, std::__to_gcc_order (__order));
327+ # else
325328 _Tp __old = this ->load (memory_order_relaxed);
326329 _Tp __new = __old + __arg;
327330 while (!this ->compare_exchange_weak (__old, __new, __order, memory_order_relaxed)) {
328331 __new = __old + __arg;
329332 }
330333 return __old;
334+ # endif
331335 }
332336 _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub (_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
337+ # ifdef _LIBCPP_COMPILER_CLANG_BASED
338+ return __atomic_fetch_sub (this ->__ptr_ , __arg, std::__to_gcc_order (__order));
339+ # else
333340 _Tp __old = this ->load (memory_order_relaxed);
334341 _Tp __new = __old - __arg;
335342 while (!this ->compare_exchange_weak (__old, __new, __order, memory_order_relaxed)) {
336343 __new = __old - __arg;
337344 }
338345 return __old;
346+ # endif
339347 }
340348
341349 _LIBCPP_HIDE_FROM_ABI _Tp operator +=(_Tp __arg) const noexcept { return fetch_add (__arg) + __arg; }
You can’t perform that action at this time.
0 commit comments