diff options
author | 2020-05-25 16:42:42 +0200 | |
---|---|---|
committer | 2020-05-25 16:42:57 +0200 | |
commit | 22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch) | |
tree | 3cf84032cc6482d685a8dbb57e015bd17c7f7fdc /src/devices/cpu/sh/sh4.cpp | |
parent | e42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (diff) |
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).
Diffstat (limited to 'src/devices/cpu/sh/sh4.cpp')
-rw-r--r-- | src/devices/cpu/sh/sh4.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/devices/cpu/sh/sh4.cpp b/src/devices/cpu/sh/sh4.cpp index b646882e0dc..0d212e7ffe2 100644 --- a/src/devices/cpu/sh/sh4.cpp +++ b/src/devices/cpu/sh/sh4.cpp @@ -2062,34 +2062,34 @@ void sh34_base_device::device_start() m_io = &space(AS_IO); if (m_program->endianness() == ENDIANNESS_LITTLE) { - auto cache = m_program->cache<3, 0, ENDIANNESS_LITTLE>(); - m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); }; + m_program->cache(m_cache64le); + m_pr16 = [this](offs_t address) -> u16 { return m_cache64le.read_word(address); }; if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE) - m_prptr = [cache](offs_t address) -> const void * { - const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7)); + m_prptr = [this](offs_t address) -> const void * { + const u16 *ptr = static_cast<u16 *>(m_cache64le.read_ptr(address & ~7)); ptr += (~address >> 1) & 3; return ptr; }; else - m_prptr = [cache](offs_t address) -> const void * { - const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7)); + m_prptr = [this](offs_t address) -> const void * { + const u16 *ptr = static_cast<u16 *>(m_cache64le.read_ptr(address & ~7)); ptr += (address >> 1) & 3; return ptr; }; } else { - auto cache = m_program->cache<3, 0, ENDIANNESS_BIG>(); - m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); }; + m_program->cache(m_cache64be); + m_pr16 = [this](offs_t address) -> u16 { return m_cache64be.read_word(address); }; if (ENDIANNESS_NATIVE != ENDIANNESS_BIG) - m_prptr = [cache](offs_t address) -> const void * { - const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7)); + m_prptr = [this](offs_t address) -> const void * { + const u16 *ptr = static_cast<u16 *>(m_cache64be.read_ptr(address & ~7)); ptr += (~address >> 1) & 3; return ptr; }; else - m_prptr = [cache](offs_t address) -> const void * { - const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7)); + m_prptr = [this](offs_t address) -> const void * { + const u16 *ptr = static_cast<u16 *>(m_cache64be.read_ptr(address & ~7)); ptr += (address >> 1) & 3; return ptr; }; |