summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2025-09-22 15:46:45 +1000
committer Vas Crabb <vas@vastheman.com>2025-09-24 02:32:49 +1000
commitac4a2e4189a19cce66106c043964befcc03be4a1 (patch)
tree2a1a6fda7508b337bf3b08371a50140bc12272d7
parent3f530da3b30461232480edb74cedefa60a2dd356 (diff)
sinclair/sprinter.cpp: Avoid dynamically allocated static object.
-rw-r--r--src/mame/sinclair/sprinter.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mame/sinclair/sprinter.cpp b/src/mame/sinclair/sprinter.cpp
index 6d1500514c2..25dc40670c1 100644
--- a/src/mame/sinclair/sprinter.cpp
+++ b/src/mame/sinclair/sprinter.cpp
@@ -70,6 +70,9 @@ TODO:
#include "speaker.h"
#include "tilemap.h"
+#include <algorithm>
+#include <iterator>
+
#include "sprinter.lh"
@@ -1434,14 +1437,16 @@ void sprinter_state::init_taps()
m_maincpu->space(AS_IO).install_write_tap(0x0000, 0xffff, "cpu_io_w", [this](offs_t offset, u8 &data, u8 mem_mask)
{
- // Internal z84 ports are not accesable through IO map, hence they need special case here
- static const std::unordered_set<u8> z84_int = {
+ // Internal z84 ports are not accessible through IO map, hence they need special case here
+ // Keep these in ascending order
+ constexpr u8 z84_int[] = {
0x10, 0x11, 0x12, 0x13,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0xee, 0xef,
0xf0, 0xf1, 0xf4
};
- if (z84_int.find(u8(offset)) != z84_int.end())
+ const auto found = std::lower_bound(std::begin(z84_int), std::end(z84_int), offset);
+ if ((found != std::end(z84_int)) && (*found == offset))
dcp_w(offset, data);
});
}