mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
netlist: clearly identify void * casts.
This commit is contained in:
parent
1fffeb33c0
commit
dd5769bea9
@ -112,13 +112,13 @@ namespace netlist
|
|||||||
template<typename O, typename C>
|
template<typename O, typename C>
|
||||||
void save(O &owner, C &state, const pstring &module, const pstring &stname)
|
void save(O &owner, C &state, const pstring &module, const pstring &stname)
|
||||||
{
|
{
|
||||||
this->run_state_manager().save_item(static_cast<void *>(&owner), state, module + "." + stname);
|
this->run_state_manager().save_item(plib::void_ptr_cast(&owner), state, module + "." + stname);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename O, typename C>
|
template<typename O, typename C>
|
||||||
void save(O &owner, C *state, const pstring &module, const pstring &stname, const std::size_t count)
|
void save(O &owner, C *state, const pstring &module, const pstring &stname, const std::size_t count)
|
||||||
{
|
{
|
||||||
this->run_state_manager().save_state_ptr(static_cast<void *>(&owner), module + "." + stname, plib::state_manager_t::dtype<C>(), count, state);
|
this->run_state_manager().save_state_ptr(plib::void_ptr_cast(&owner), module + "." + stname, plib::state_manager_t::dtype<C>(), count, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: only used by queue_t save state
|
// FIXME: only used by queue_t save state
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
/// This is about 10% slower on a skylake processor for pongf.
|
/// This is about 10% slower on a skylake processor for pongf.
|
||||||
///
|
///
|
||||||
#ifndef NL_PREFER_INT128
|
#ifndef NL_PREFER_INT128
|
||||||
#define NL_PREFER_INT128 (1)
|
#define NL_PREFER_INT128 (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// \brief Support float type for matrix calculations.
|
/// \brief Support float type for matrix calculations.
|
||||||
|
@ -288,7 +288,7 @@ namespace plib {
|
|||||||
void construct(U* p, Args&&... args)
|
void construct(U* p, Args&&... args)
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
|
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
|
||||||
::new (static_cast<void *>(p)) U(std::forward<Args>(args)...);
|
::new (void_ptr_cast(p)) U(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
template<typename U>
|
||||||
|
@ -93,7 +93,7 @@ namespace plib {
|
|||||||
/// and later for debug builds use dynamic_cast.
|
/// and later for debug builds use dynamic_cast.
|
||||||
///
|
///
|
||||||
template <typename D, typename B>
|
template <typename D, typename B>
|
||||||
inline constexpr D downcast(B && b) noexcept
|
constexpr D downcast(B && b) noexcept
|
||||||
{
|
{
|
||||||
static_assert(std::is_pointer<D>::value || std::is_reference<D>::value, "downcast only supports pointers or reference for derived");
|
static_assert(std::is_pointer<D>::value || std::is_reference<D>::value, "downcast only supports pointers or reference for derived");
|
||||||
static_assert(std::is_pointer<B>::value || std::is_reference<B>::value, "downcast only supports pointers or reference for base");
|
static_assert(std::is_pointer<B>::value || std::is_reference<B>::value, "downcast only supports pointers or reference for base");
|
||||||
@ -101,6 +101,10 @@ namespace plib {
|
|||||||
}
|
}
|
||||||
|
|
||||||
using pgsl::narrow_cast;
|
using pgsl::narrow_cast;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
constexpr void * void_ptr_cast(T *ptr) noexcept { return static_cast<void *>(ptr); }
|
||||||
|
|
||||||
} // namespace plib
|
} // namespace plib
|
||||||
|
|
||||||
//FIXME: This is the place to use more complete implementations
|
//FIXME: This is the place to use more complete implementations
|
||||||
|
Loading…
Reference in New Issue
Block a user