1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 20:41:45 +01:00

Util/fixed_typemap.hpp: set unitialiazed data to trap values

This commit is contained in:
Eladash 2023-12-14 20:09:41 +02:00 committed by Elad Ashkenazi
parent 0c410f8a14
commit 2190419b83
2 changed files with 8 additions and 2 deletions

View File

@ -44,6 +44,7 @@ namespace stx
static void call_dtor(void* ptr) noexcept
{
std::launder(static_cast<T*>(ptr))->~T();
std::memset(ptr, 0xCC, sizeof(T)); // Set to trap values
}
template <typename T>
@ -93,9 +94,11 @@ namespace stx
{
ensure(Size >= stx::typelist<typeinfo>().size());
ensure(Align >= stx::typelist<typeinfo>().align());
m_data[0] = 0;
}
// Set to trap values
std::memset(Size == 0 ? m_list : m_data, 0xCC, stx::typelist<typeinfo>().size());
for (const auto& type : stx::typelist<typeinfo>())
{
const u32 id = type.index();

View File

@ -122,6 +122,7 @@ namespace stx
static void call_dtor(void* ptr) noexcept
{
std::launder(static_cast<T*>(ptr))->~T();
std::memset(ptr, 0xCC, sizeof(T)); // Set to trap values
}
template <typename T>
@ -219,9 +220,11 @@ namespace stx
{
ensure(Size >= stx::typelist<typeinfo>().size());
ensure(Align >= stx::typelist<typeinfo>().align());
m_data[0] = 0;
}
// Set to trap values
std::memset(Size == 0 ? m_list : m_data, 0xCC, stx::typelist<typeinfo>().size());
*m_order++ = nullptr;
*m_info++ = nullptr;
}