Skip to content

Commit

Permalink
_rawPtrToAtomic: Assert std::atomic size and pointer alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
capitalistspz committed Sep 16, 2024
1 parent 035f08c commit 3115aff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Common/precompiled.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ bool future_is_ready(std::future<T>& f)
template<typename T>
std::atomic<T>* _rawPtrToAtomic(T* ptr)
{
static_assert(sizeof(T) == sizeof(std::atomic<T>));
cemu_assert_debug((reinterpret_cast<std::uintptr_t>(ptr) % alignof(std::atomic<T>)) == 0);
return reinterpret_cast<std::atomic<T>*>(ptr);
}

Expand Down

0 comments on commit 3115aff

Please sign in to comment.