Skip to content

Commit a115d4c

Browse files
committed
sinclair/sprinter.cpp: Avoid dynamically allocated static object.
1 parent 096cf5f commit a115d4c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/mame/sinclair/sprinter.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Following manual configuration adjustments are recommended for better experience
7070
#include "speaker.h"
7171
#include "tilemap.h"
7272

73+
#include <algorithm>
74+
#include <iterator>
75+
7376
#include "sprinter.lh"
7477

7578

@@ -1434,14 +1437,16 @@ void sprinter_state::init_taps()
14341437

14351438
m_maincpu->space(AS_IO).install_write_tap(0x0000, 0xffff, "cpu_io_w", [this](offs_t offset, u8 &data, u8 mem_mask)
14361439
{
1437-
// Internal z84 ports are not accesable through IO map, hence they need special case here
1438-
static const std::unordered_set<u8> z84_int = {
1440+
// Internal z84 ports are not accessible through IO map, hence they need special case here
1441+
// Keep these in ascending order
1442+
constexpr u8 z84_int[] = {
14391443
0x10, 0x11, 0x12, 0x13,
14401444
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
14411445
0xee, 0xef,
14421446
0xf0, 0xf1, 0xf4
14431447
};
1444-
if (z84_int.find(u8(offset)) != z84_int.end())
1448+
const auto found = std::lower_bound(std::begin(z84_int), std::end(z84_int), offset);
1449+
if ((found != std::end(z84_int)) && (*found == offset))
14451450
dcp_w(offset, data);
14461451
});
14471452
}

0 commit comments

Comments
 (0)