diff options
author | couriersud <couriersud@users.noreply.github.com> | 2022-06-20 20:01:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 20:01:03 +0200 |
commit | 0dad442511fc3e96bae721c38fe8040a222cc21a (patch) | |
tree | b0eb0732f9e7f438a41a889621d36193d16d6e1b /src/devices | |
parent | 3fbfe0b1d76573ee8971eaaee6b37b4024575624 (diff) |
netlist: fix bug, prepare for future changes and improve readability (#9947)
* netlist: fix bug, prepare for future changes and improve readability
- fix a bug where a net processing error may trigger a nullptr access
- applied some clang-tidy recommendations
- add no_return to plib::terminate
- properly encapsulate dynamic_cast usage
- more review of noexcept
- added a clang-format file. Over time, all source files will be
processed with clang-format
- Used clang format on a number of files
- Rewrote 74174
- all device constructors now use a struct to pass data on
to base classes. Neither netlist state nor the name are intended
to be used in a constructor. After the base class was
constructed, they can be accessed by state() and name().
- The device construction macros can now be removed. Changes to
the core will not need to be reflected in constructors.
- Change truth table macros so that going forward NETLIST_END and
TRUTH_TABLE_END can be replaced by a closing curly brace. netlists can
than use curly braces enclosed blocks.
- more clang-format
- removed some macros completely
- all derived classes from base_device_t now don't use macros
any longer.
- as a result, delegator_t was removed. This class was only used
to support macros :-(
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/machine/netlist.cpp | 10 | ||||
-rw-r--r-- | src/devices/machine/netlist.h | 15 | ||||
-rw-r--r-- | src/devices/video/fixfreq.cpp | 5 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 973a5f2cb25..af55f7338d0 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -1252,6 +1252,16 @@ uint64_t netlist_mame_cpu_device::execute_cycles_to_clocks(uint64_t cycles) cons return cycles; } +netlist::netlist_time_ext netlist_mame_cpu_device::nltime_ext_from_clocks(unsigned c) const noexcept +{ + return (m_div * c).shr(MDIV_SHIFT); +} + +netlist::netlist_time netlist_mame_cpu_device::nltime_from_clocks(unsigned c) const noexcept +{ + return static_cast<netlist::netlist_time>((m_div * c).shr(MDIV_SHIFT)); +} + void netlist_mame_cpu_device::execute_run() { //m_ppc = m_pc; // copy PC to previous PC diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index dc1f651e1c4..ff9adf7d332 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -193,16 +193,6 @@ public: void update_icount(netlist::netlist_time_ext time) noexcept; void check_mame_abort_slice() noexcept; - netlist::netlist_time_ext nltime_ext_from_clocks(unsigned c) const noexcept - { - return (m_div * c).shr(MDIV_SHIFT); - } - - netlist::netlist_time nltime_from_clocks(unsigned c) const noexcept - { - return static_cast<netlist::netlist_time>((m_div * c).shr(MDIV_SHIFT)); - } - protected: // netlist_mame_device virtual void nl_register_devices(netlist::nlparse_t &parser) const override; @@ -229,6 +219,9 @@ protected: address_space_config m_program_config; private: + netlist::netlist_time_ext nltime_ext_from_clocks(unsigned c) const noexcept; + netlist::netlist_time nltime_from_clocks(unsigned c) const noexcept; + int m_icount; netlist::netlist_time_ext m_div; netlist::netlist_time_ext m_rem; @@ -255,6 +248,8 @@ private: // ---------------------------------------------------------------------------------------- // netlist_mame_sound_input_buffer +// +// This is a wrapper device to provide operator[] on read_stream_view. // ---------------------------------------------------------------------------------------- class netlist_mame_sound_input_buffer : public read_stream_view diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp index 74db7c77216..e3f2f5f735d 100644 --- a/src/devices/video/fixfreq.cpp +++ b/src/devices/video/fixfreq.cpp @@ -19,9 +19,14 @@ #include "render.h" #include "ui/uimain.h" +#include <cstdio> + // for quick and dirty debugging #define VERBOSE 0 +#define LOG_GENERAL (1U << 0) + #define LOG_OUTPUT_STREAM std::cerr + #include "logmacro.h" #include <algorithm> |