summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2019-10-26 23:47:34 +1100
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2019-10-26 23:47:34 +1100
commit9ce4a078e0707dfbcace92abf4dc1375d811d0f8 (patch)
tree91b6c7c92217a525d816511ab7e404e1d3bce5a9 /src/emu
parent09ac3ebfc3ece16c7e9a88157f4919ba939e3b7f (diff)
(nw) move some stuff to an anonymous namespace, and fully specialise templates that are no longer member classes
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/emumem.cpp104
1 files changed, 54 insertions, 50 deletions
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index cccee057ad1..691917bc4a5 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -208,9 +208,63 @@ static char *core_i64_hex_format(u64 value, u8 mindigits)
// CONSTANTS
//**************************************************************************
+namespace {
+
+template <typename Delegate> struct handler_width;
+template <> struct handler_width<read8_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<read8m_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<read8s_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<read8sm_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<read8mo_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<read8smo_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<write8_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<write8m_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<write8s_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<write8sm_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<write8mo_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<write8smo_delegate> { static constexpr int value = 0; };
+template <> struct handler_width<read16_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<read16m_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<read16s_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<read16sm_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<read16mo_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<read16smo_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<write16_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<write16m_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<write16s_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<write16sm_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<write16mo_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<write16smo_delegate> { static constexpr int value = 1; };
+template <> struct handler_width<read32_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<read32m_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<read32s_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<read32sm_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<read32mo_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<read32smo_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<write32_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<write32m_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<write32s_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<write32sm_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<write32mo_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<write32smo_delegate> { static constexpr int value = 2; };
+template <> struct handler_width<read64_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<read64m_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<read64s_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<read64sm_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<read64mo_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<read64smo_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<write64_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<write64m_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<write64s_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<write64sm_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<write64mo_delegate> { static constexpr int value = 3; };
+template <> struct handler_width<write64smo_delegate> { static constexpr int value = 3; };
+
// other address map constants
const int MEMORY_BLOCK_CHUNK = 65536; // minimum chunk size of allocated memory blocks
+} // anonymous namespace
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -226,56 +280,6 @@ class address_space_specific : public address_space
using NativeType = uX;
using this_type = address_space_specific<Width, AddrShift, Endian>;
- template <typename Delegate, typename Dummy = void> struct handler_width;
- template <typename Dummy> struct handler_width<read8_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<read8m_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<read8s_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<read8sm_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<read8mo_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<read8smo_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<write8_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<write8m_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<write8s_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<write8sm_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<write8mo_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<write8smo_delegate, Dummy> { static constexpr int value = 0; };
- template <typename Dummy> struct handler_width<read16_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<read16m_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<read16s_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<read16sm_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<read16mo_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<read16smo_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<write16_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<write16m_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<write16s_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<write16sm_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<write16mo_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<write16smo_delegate, Dummy> { static constexpr int value = 1; };
- template <typename Dummy> struct handler_width<read32_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<read32m_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<read32s_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<read32sm_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<read32mo_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<read32smo_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<write32_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<write32m_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<write32s_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<write32sm_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<write32mo_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<write32smo_delegate, Dummy> { static constexpr int value = 2; };
- template <typename Dummy> struct handler_width<read64_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<read64m_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<read64s_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<read64sm_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<read64mo_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<read64smo_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<write64_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<write64m_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<write64s_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<write64sm_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<write64mo_delegate, Dummy> { static constexpr int value = 3; };
- template <typename Dummy> struct handler_width<write64smo_delegate, Dummy> { static constexpr int value = 3; };
-
// constants describing the native size
static constexpr u32 NATIVE_BYTES = 1 << Width;
static constexpr u32 NATIVE_STEP = AddrShift >= 0 ? NATIVE_BYTES << iabs(AddrShift) : NATIVE_BYTES >> iabs(AddrShift);