diff options
| author | c8ef <c8ef@outlook.com> | 2026-02-22 21:14:58 +0800 |
|---|---|---|
| committer | c8ef <c8ef@outlook.com> | 2026-02-22 21:14:58 +0800 |
| commit | 609e1196aa5098cbbd3e27a02d21beb42c98ecfe (patch) | |
| tree | 1e22ab7c7fe077581f9cf056aa50f56a23fc7092 | |
| parent | c3e318d67841e8076a2e99f9c79d64873178dab2 (diff) | |
| download | llvm-users/c8ef/atomic_minmax.tar.gz llvm-users/c8ef/atomic_minmax.tar.bz2 llvm-users/c8ef/atomic_minmax.zip | |
fix gcc ciusers/c8ef/atomic_minmax
| -rw-r--r-- | libcxx/include/__atomic/atomic_ref.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h index ec98fab310c7..e0f28f4a3e20 100644 --- a/libcxx/include/__atomic/atomic_ref.h +++ b/libcxx/include/__atomic/atomic_ref.h @@ -406,11 +406,10 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> { # if _LIBCPP_STD_VER >= 26 _LIBCPP_HIDE_FROM_ABI _Tp* fetch_max(_Tp* __arg, memory_order __order = memory_order_seq_cst) const noexcept { # if __has_builtin(__atomic_fetch_max) - return reinterpret_cast<_Tp*>(__atomic_fetch_max( - reinterpret_cast<uintptr_t*>(this->__ptr_), reinterpret_cast<uintptr_t>(__arg), std::__to_gcc_order(__order))); + return __atomic_fetch_max(this->__ptr_, __arg * sizeof(_Tp), std::__to_gcc_order(__order)); # else - _Tp __old = this->load(memory_order_relaxed); - _Tp __new; + _Tp* __old = this->load(memory_order_relaxed); + _Tp* __new; do { __new = __old > __arg ? __old : __arg; } while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)); @@ -419,11 +418,10 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> { } _LIBCPP_HIDE_FROM_ABI _Tp* fetch_min(_Tp* __arg, memory_order __order = memory_order_seq_cst) const noexcept { # if __has_builtin(__atomic_fetch_min) - return reinterpret_cast<_Tp*>(__atomic_fetch_min( - reinterpret_cast<uintptr_t*>(this->__ptr_), reinterpret_cast<uintptr_t>(__arg), std::__to_gcc_order(__order))); + return __atomic_fetch_min(this->__ptr_, __arg * sizeof(_Tp), std::__to_gcc_order(__order)); # else - _Tp __old = this->load(memory_order_relaxed); - _Tp __new; + _Tp* __old = this->load(memory_order_relaxed); + _Tp* __new; do { __new = __old < __arg ? __old : __arg; } while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)); |
