From 22513fb6fe281f5ccb75aaddb6417a12a66c313d Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 25 May 2020 16:42:42 +0200 Subject: emumem: A little more speedup. cache and specific change syntax, and are not pointers anymore [O. Galibert] The last(?) two changes are: - Add a template parameter to everything (theoretically the address space width, in practice a level derived from it to keep as much compatibility between widths as possible) so that the shift size becomes a constant. - Change the syntax of declaring and initializing the caches and specifics so that they're embedded in the owner device. Solves lifetime issues and also removes one indirection (looking up the base dispatch pointer through the cache/specific pointer). --- src/devices/sound/vrender0.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/devices/sound/vrender0.cpp') diff --git a/src/devices/sound/vrender0.cpp b/src/devices/sound/vrender0.cpp index 833acdc46bb..370bc2f44e0 100644 --- a/src/devices/sound/vrender0.cpp +++ b/src/devices/sound/vrender0.cpp @@ -142,11 +142,11 @@ void vr0sound_device::device_start() m_irq_cb.resolve_safe(); // Find our direct access - m_texcache = space(AS_TEXTURE).cache<1, 0, ENDIANNESS_LITTLE>(); - m_fbcache = space(AS_FRAME).cache<1, 0, ENDIANNESS_LITTLE>(); - m_texcache_ctrl = m_fbcache; + space(AS_TEXTURE).cache(m_texcache); + space(AS_FRAME).cache(m_fbcache); + m_texcache_ctrl = &m_fbcache; for (auto &elem : m_channel) - elem.Cache = m_fbcache; + elem.Cache = &m_fbcache; m_stream = stream_alloc(0, 2, clock() / 972); // TODO : Correct source / divider? @@ -229,7 +229,7 @@ void vr0sound_device::channel_w(offs_t offset, u16 data, u16 mem_mask) m_channel[(offset >> 4) & 0x1f].write(offset & 0xf, data, mem_mask); if ((old_mode ^ channel->Modes) & MODE_TEXTURE) { - channel->Cache = (channel->Modes & MODE_TEXTURE) ? m_texcache_ctrl : m_fbcache; + channel->Cache = (channel->Modes & MODE_TEXTURE) ? m_texcache_ctrl : &m_fbcache; } } @@ -356,7 +356,7 @@ void vr0sound_device::ctrl_w(offs_t offset, u16 data, u16 mem_mask) const u16 old_ctrl = m_Ctrl; COMBINE_DATA(&m_Ctrl); if ((old_ctrl ^ m_Ctrl) & CTRL_TM) - m_texcache_ctrl = (m_Ctrl & CTRL_TM) ? m_texcache : m_fbcache; + m_texcache_ctrl = (m_Ctrl & CTRL_TM) ? &m_texcache : &m_fbcache; } /* -- cgit v1.2.3-70-g09d2