diff options
author | Vas Crabb <vas@vastheman.com> | 2022-06-16 03:32:46 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2022-06-16 03:32:46 +1000 |
commit | 1964365f34499ae5785c7b8f13836caa05156dfa (patch) | |
tree | 15ce654e3170c3509db1fddbb9b70a194f77cb46 /src/osd/osdcomm.h | |
parent | d345b7ec2ccf3c9a958bddd3906a202e42a88809 (diff) |
Optimisation, and baby steps towards untangling stuff:
Optimised the scheduler's handling of unscheduled timers - gives a 50%
performance improvement in some timer-heavy drivers.
Added better endianness swizzling helpers.
Got rid of some of the OSD input modules' dependence on concrete input
classes from emu.
Diffstat (limited to '')
-rw-r--r-- | src/osd/osdcomm.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index 0b372e4e61e..516dd3e681a 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -71,6 +71,7 @@ using s64 = std::int64_t; } // namespace OSD + /*************************************************************************** FUNDAMENTAL MACROS ***************************************************************************/ @@ -111,4 +112,25 @@ using ssize_t = std::make_signed_t<size_t>; #endif #endif + +// macro for defining a copy constructor and assignment operator to prevent copying +#define DISABLE_COPYING(TYPE) \ + TYPE(const TYPE &) = delete; \ + TYPE &operator=(const TYPE &) = delete + +// macro for declaring enumeration operators that increment/decrement like plain old C +#define DECLARE_ENUM_INCDEC_OPERATORS(TYPE) \ +inline TYPE &operator++(TYPE &value) { return value = TYPE(std::underlying_type_t<TYPE>(value) + 1); } \ +inline TYPE &operator--(TYPE &value) { return value = TYPE(std::underlying_type_t<TYPE>(value) - 1); } \ +inline TYPE operator++(TYPE &value, int) { TYPE const old(value); ++value; return old; } \ +inline TYPE operator--(TYPE &value, int) { TYPE const old(value); --value; return old; } + +// macro for declaring bitwise operators for an enumerated type +#define DECLARE_ENUM_BITWISE_OPERATORS(TYPE) \ +constexpr TYPE operator~(TYPE value) { return TYPE(~std::underlying_type_t<TYPE>(value)); } \ +constexpr TYPE operator&(TYPE a, TYPE b) { return TYPE(std::underlying_type_t<TYPE>(a) & std::underlying_type_t<TYPE>(b)); } \ +constexpr TYPE operator|(TYPE a, TYPE b) { return TYPE(std::underlying_type_t<TYPE>(a) | std::underlying_type_t<TYPE>(b)); } \ +inline TYPE &operator&=(TYPE &a, TYPE b) { return a = a & b; } \ +inline TYPE &operator|=(TYPE &a, TYPE b) { return a = a | b; } + #endif // MAME_OSD_OSDCOMM_H |