mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
fixed_typemap.hpp: add range iterator
Remove recently added functions.
This commit is contained in:
parent
4f76211551
commit
2d3fe7ce1c
@ -1542,33 +1542,25 @@ void Emulator::Stop(bool restart)
|
||||
|
||||
cpu_thread::stop_all();
|
||||
|
||||
using fxo_t = std::remove_pointer_t<decltype(g_fxo)>;
|
||||
|
||||
// Signal threads
|
||||
for (const auto& type : fxo_t::view_typelist())
|
||||
for (const auto& [type, data] : *g_fxo)
|
||||
{
|
||||
if (type.stop)
|
||||
{
|
||||
if (auto data = g_fxo->try_get(type))
|
||||
{
|
||||
type.stop(data, thread_state::aborting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetCallbacks().on_stop();
|
||||
|
||||
// Join threads
|
||||
for (const auto& type : fxo_t::view_typelist())
|
||||
for (const auto& [type, data] : *g_fxo)
|
||||
{
|
||||
if (type.stop)
|
||||
{
|
||||
if (auto data = g_fxo->try_get(type))
|
||||
{
|
||||
type.stop(data, thread_state::finished);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cpu_thread::cleanup();
|
||||
|
||||
|
@ -155,8 +155,8 @@ namespace stx
|
||||
clear();
|
||||
}
|
||||
|
||||
m_order = new void*[stx::typelist<typeinfo>().count()];
|
||||
m_info = new const typeinfo*[stx::typelist<typeinfo>().count()];
|
||||
m_order = new void*[stx::typelist<typeinfo>().count() + 1];
|
||||
m_info = new const typeinfo*[stx::typelist<typeinfo>().count() + 1];
|
||||
m_init = new bool[stx::typelist<typeinfo>().count()]{};
|
||||
|
||||
if constexpr (Size == 0)
|
||||
@ -176,6 +176,9 @@ namespace stx
|
||||
ensure(Align >= stx::typelist<typeinfo>().align());
|
||||
m_data[0] = 0;
|
||||
}
|
||||
|
||||
*m_order++ = nullptr;
|
||||
*m_info++ = nullptr;
|
||||
}
|
||||
|
||||
void init(bool reset = true)
|
||||
@ -231,6 +234,8 @@ namespace stx
|
||||
}
|
||||
|
||||
// Pointers should be restored to their positions
|
||||
m_info--;
|
||||
m_order--;
|
||||
delete[] m_init;
|
||||
delete[] m_info;
|
||||
delete[] m_order;
|
||||
@ -344,20 +349,51 @@ namespace stx
|
||||
[[unlikely]] return nullptr;
|
||||
}
|
||||
|
||||
static const auto& view_typelist() noexcept
|
||||
class iterator
|
||||
{
|
||||
const typeinfo** m_info;
|
||||
void** m_ptr;
|
||||
|
||||
public:
|
||||
iterator(const typeinfo** _info, void** _ptr)
|
||||
: m_info(_info)
|
||||
, m_ptr(_ptr)
|
||||
{
|
||||
return stx::typelist<typeinfo>();
|
||||
}
|
||||
|
||||
// Get type-erased raw pointer to storage of type
|
||||
uchar* try_get(const type_info<typeinfo>& type) const noexcept
|
||||
std::pair<const typeinfo&, void*> operator*() const
|
||||
{
|
||||
if (m_init[type.index()])
|
||||
{
|
||||
[[likely]] return (Size ? +m_data : m_list) + type.pos();
|
||||
return {*m_info[-1], m_ptr[-1]};
|
||||
}
|
||||
|
||||
[[unlikely]] return nullptr;
|
||||
iterator& operator++()
|
||||
{
|
||||
m_info--;
|
||||
m_ptr--;
|
||||
|
||||
if (!m_info[-1])
|
||||
{
|
||||
m_info = nullptr;
|
||||
m_ptr = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator!=(const iterator& rhs) const
|
||||
{
|
||||
return m_info != rhs.m_info || m_ptr != rhs.m_ptr;
|
||||
}
|
||||
};
|
||||
|
||||
iterator begin() noexcept
|
||||
{
|
||||
return iterator{m_info, m_order};
|
||||
}
|
||||
|
||||
iterator end() noexcept
|
||||
{
|
||||
return iterator{nullptr, nullptr};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ constexpr unsigned __builtin_COLUMN()
|
||||
}
|
||||
#endif
|
||||
|
||||
template <usz Size = usz(-1)>
|
||||
template <usz Size = umax>
|
||||
struct const_str_t
|
||||
{
|
||||
static constexpr usz size = Size;
|
||||
@ -792,7 +792,7 @@ struct const_str_t
|
||||
};
|
||||
|
||||
template <>
|
||||
struct const_str_t<usz(-1)>
|
||||
struct const_str_t<umax>
|
||||
{
|
||||
const usz size;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user