mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-25 13:37:01 +00:00
Merge branch 'main' into metal
This commit is contained in:
commit
c01e6bf3b8
139 changed files with 20426 additions and 15557 deletions
|
|
@ -616,4 +616,36 @@ namespace stdx
|
|||
scope_exit& operator=(scope_exit) = delete;
|
||||
void release() { m_released = true;}
|
||||
};
|
||||
|
||||
// Xcode 16 doesn't have std::atomic_ref support and we provide a minimalist reimplementation as fallback
|
||||
#ifdef __cpp_lib_atomic_ref
|
||||
#include <atomic>
|
||||
template<typename T>
|
||||
using atomic_ref = std::atomic_ref<T>;
|
||||
#else
|
||||
template<typename T>
|
||||
class atomic_ref
|
||||
{
|
||||
static_assert(std::is_trivially_copyable<T>::value, "atomic_ref requires trivially copyable types");
|
||||
public:
|
||||
using value_type = T;
|
||||
|
||||
explicit atomic_ref(T& obj) noexcept : ptr_(std::addressof(obj)) {}
|
||||
|
||||
T load(std::memory_order order = std::memory_order_seq_cst) const noexcept
|
||||
{
|
||||
auto aptr = reinterpret_cast<std::atomic<T>*>(ptr_);
|
||||
return aptr->load(order);
|
||||
}
|
||||
|
||||
void store(T desired, std::memory_order order = std::memory_order_seq_cst) const noexcept
|
||||
{
|
||||
auto aptr = reinterpret_cast<std::atomic<T>*>(ptr_);
|
||||
aptr->store(desired, order);
|
||||
}
|
||||
|
||||
private:
|
||||
T* ptr_;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue