From 3115aff4355e2bdaf4a02cec3d72beb1912e509e Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Mon, 16 Sep 2024 13:03:10 +0100 Subject: [PATCH] `_rawPtrToAtomic`: Assert std::atomic size and pointer alignment --- src/Common/precompiled.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Common/precompiled.h b/src/Common/precompiled.h index 7b0e8c64b..f8fc80ceb 100644 --- a/src/Common/precompiled.h +++ b/src/Common/precompiled.h @@ -502,6 +502,8 @@ bool future_is_ready(std::future& f) template std::atomic* _rawPtrToAtomic(T* ptr) { + static_assert(sizeof(T) == sizeof(std::atomic)); + cemu_assert_debug((reinterpret_cast(ptr) % alignof(std::atomic)) == 0); return reinterpret_cast*>(ptr); }