Removed some auto_mallocs in favor of dynamic_arrays.

Added option to clear dynamic_arrays; on gcc this should assert if not
done on POD (which is unsafe to memset).
This commit is contained in:
Aaron Giles 2014-02-19 17:45:48 +00:00
parent c33da39e3d
commit df5a4f15f8
67 changed files with 141 additions and 206 deletions

View File

@ -39,8 +39,6 @@ const device_type ADAM_EXPANSION_SLOT = &device_creator<adam_expansion_slot_devi
device_adam_expansion_slot_card_interface::device_adam_expansion_slot_card_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_rom(NULL),
m_ram(NULL),
m_rom_mask(0),
m_ram_mask(0)
{
@ -63,9 +61,9 @@ device_adam_expansion_slot_card_interface::~device_adam_expansion_slot_card_inte
UINT8* device_adam_expansion_slot_card_interface::adam_rom_pointer(running_machine &machine, size_t size)
{
if (m_rom == NULL)
if (m_rom.count() == 0)
{
m_rom = auto_alloc_array(machine, UINT8, size);
m_rom.resize(size);
m_rom_mask = size - 1;
}
@ -80,9 +78,9 @@ UINT8* device_adam_expansion_slot_card_interface::adam_rom_pointer(running_machi
UINT8* device_adam_expansion_slot_card_interface::adam_ram_pointer(running_machine &machine, size_t size)
{
if (m_ram == NULL)
if (m_ram.count() == 0)
{
m_ram = auto_alloc_array(machine, UINT8, size);
m_ram.resize(size);
m_ram_mask = size - 1;
}

View File

@ -128,8 +128,8 @@ protected:
adam_expansion_slot_device *m_slot;
UINT8 *m_rom;
UINT8 *m_ram;
dynamic_array<UINT8> m_rom;
dynamic_array<UINT8> m_ram;
size_t m_rom_mask;
size_t m_ram_mask;

View File

@ -57,8 +57,6 @@ iq151_grafik_device::iq151_grafik_device(const machine_config &mconfig, const ch
void iq151_grafik_device::device_start()
{
// allocate the videoram
m_videoram = (UINT8*)auto_alloc_array_clear(machine(), UINT8, 0x4000);
}
//-------------------------------------------------
@ -73,7 +71,7 @@ void iq151_grafik_device::device_reset()
if (screen->visible_area().max_x < 64*8-1)
screen->set_visible_area(0, 64*8-1, 0, 32*8-1);
memset(m_videoram, 0x00, 0x4000);
memset(m_videoram, 0x00, sizeof(m_videoram));
}
//-------------------------------------------------

View File

@ -45,7 +45,6 @@ private:
required_device<i8255_device> m_ppi8255;
UINT8 * m_videoram;
UINT8 m_posx; // horizontal position
UINT8 m_posy; // vertical position
UINT8 m_all; // 0: bit mode 1: byte mode
@ -54,6 +53,7 @@ private:
UINT8 m_ev; // enable video out
UINT8 m_ex;
UINT8 m_sel; // enable vram access
UINT8 m_videoram[0x4000];
};

View File

@ -344,7 +344,6 @@ void device_nubus_card_interface::install_bank(offs_t start, offs_t end, offs_t
void device_nubus_card_interface::install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb, bool reverse_rom)
{
bool inverted = false;
UINT8 *newrom = NULL;
astring tempstring;
UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->base();
@ -384,75 +383,75 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
switch (byteLanes)
{
case 0x0f: // easy case: all 4 lanes (still must scramble for 32-bit BE bus though)
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen);
m_declaration_rom.resize(romlen);
for (int i = 0; i < romlen; i++)
{
newrom[BYTE4_XOR_BE(i)] = rom[i];
m_declaration_rom[BYTE4_XOR_BE(i)] = rom[i];
}
break;
case 0xe1: // lane 0 only
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*4);
m_declaration_rom.resize_and_clear(romlen*4);
for (int i = 0; i < romlen; i++)
{
newrom[BYTE4_XOR_BE(i*4)] = rom[i];
m_declaration_rom[BYTE4_XOR_BE(i*4)] = rom[i];
}
romlen *= 4;
break;
case 0xd2: // lane 1 only
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*4);
m_declaration_rom.resize_and_clear(romlen*4);
for (int i = 0; i < romlen; i++)
{
newrom[BYTE4_XOR_BE((i*4)+1)] = rom[i];
m_declaration_rom[BYTE4_XOR_BE((i*4)+1)] = rom[i];
}
romlen *= 4;
break;
case 0xb4: // lane 2 only
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*4);
m_declaration_rom.resize_and_clear(romlen*4);
for (int i = 0; i < romlen; i++)
{
newrom[BYTE4_XOR_BE((i*4)+2)] = rom[i];
m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[i];
}
romlen *= 4;
break;
case 0x78: // lane 3 only
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*4);
m_declaration_rom.resize_and_clear(romlen*4);
for (int i = 0; i < romlen; i++)
{
newrom[BYTE4_XOR_BE((i*4)+3)] = rom[i];
m_declaration_rom[BYTE4_XOR_BE((i*4)+3)] = rom[i];
}
romlen *= 4;
break;
case 0xc3: // lanes 0, 1
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*2);
m_declaration_rom.resize_and_clear(romlen*2);
for (int i = 0; i < romlen/2; i++)
{
newrom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)];
newrom[BYTE4_XOR_BE((i*4)+1)] = rom[(i*2)+1];
m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)];
m_declaration_rom[BYTE4_XOR_BE((i*4)+1)] = rom[(i*2)+1];
}
romlen *= 2;
break;
case 0xa5: // lanes 0, 2
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*2);
m_declaration_rom.resize_and_clear(romlen*2);
for (int i = 0; i < romlen/2; i++)
{
newrom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)];
newrom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)+1];
m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)];
m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)+1];
}
romlen *= 2;
break;
case 0x3c: // lanes 2,3
newrom = auto_alloc_array_clear(device().machine(), UINT8, romlen*2);
m_declaration_rom.resize_and_clear(romlen*2);
for (int i = 0; i < romlen/2; i++)
{
newrom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)];
newrom[BYTE4_XOR_BE((i*4)+3)] = rom[(i*2)+1];
m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)];
m_declaration_rom[BYTE4_XOR_BE((i*4)+3)] = rom[(i*2)+1];
}
romlen *= 2;
break;
@ -467,7 +466,7 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
{
for (int i = 0; i < romlen; i++)
{
newrom[i] ^= 0xff;
m_declaration_rom[i] ^= 0xff;
}
}
@ -480,10 +479,10 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c
// printf("Installing ROM at %x, length %x\n", addr, romlen);
if (mirror_all_mb) // mirror the declaration ROM across all 16 megs of the slot space
{
m_nubus->install_bank(addr, addr+romlen-1, 0, 0x00f00000, bankname, newrom);
m_nubus->install_bank(addr, addr+romlen-1, 0, 0x00f00000, bankname, m_declaration_rom);
}
else
{
m_nubus->install_bank(addr, addr+romlen-1, 0, 0, bankname, newrom);
m_nubus->install_bank(addr, addr+romlen-1, 0, 0, bankname, m_declaration_rom);
}
}

View File

@ -160,6 +160,7 @@ public:
const char *m_nubus_tag, *m_nubus_slottag;
int m_slot;
device_nubus_card_interface *m_next;
dynamic_buffer m_declaration_rom;
};
#endif /* __NUBUS_H__ */

View File

@ -9,11 +9,11 @@
#include "emu.h"
#include "nubus_48gc.h"
#define VRAM_SIZE (0x200000) // 2 megs, maxed out
#define GC48_SCREEN_NAME "48gc_screen"
#define GC48_ROM_REGION "48gc_rom"
#define VRAM_SIZE (0x200000) // 2 megs, maxed out
MACHINE_CONFIG_FRAGMENT( macvideo_48gc )
MCFG_SCREEN_ADD( GC48_SCREEN_NAME, RASTER)
MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, jmfb_device, screen_update)
@ -111,7 +111,7 @@ void jmfb_device::device_start()
// printf("[JMFB %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram.resize(VRAM_SIZE);
install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_48gc", m_vram);
m_nubus->install_device(slotspace+0x200000, slotspace+0x2003ff, read32_delegate(FUNC(jmfb_device::mac_48gc_r), this), write32_delegate(FUNC(jmfb_device::mac_48gc_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(mac_48gc_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 m_mode, m_vbl_disable, m_toggle, m_stride, m_base;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;
UINT32 m_registers[0x100];

View File

@ -95,7 +95,7 @@ void nubus_cb264_device::device_start()
// printf("[cb264 %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram.resize(VRAM_SIZE);
install_bank(slotspace, slotspace+VRAM_SIZE-1, 0, 0, "bank_cb264", m_vram);
m_nubus->install_device(slotspace+0xff6000, slotspace+0xff60ff, read32_delegate(FUNC(nubus_cb264_device::cb264_r), this), write32_delegate(FUNC(nubus_cb264_device::cb264_w), this));
@ -203,7 +203,7 @@ UINT32 nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &bi
case 4: // 24 bpp
case 7: // ???
{
UINT32 *vram32 = (UINT32 *)m_vram;
UINT32 *vram32 = (UINT32 *)&m_vram[0];
for (y = 0; y < 480; y++)
{

View File

@ -37,7 +37,7 @@ protected:
DECLARE_WRITE32_MEMBER(cb264_ramdac_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 m_cb264_mode, m_cb264_vbl_disable, m_cb264_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;
};

View File

@ -97,8 +97,8 @@ void nubus_m2hires_device::device_start()
// printf("[m2hires %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_m2hires_device::vram_r), this), write32_delegate(FUNC(nubus_m2hires_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_m2hires_device::vram_r), this), write32_delegate(FUNC(nubus_m2hires_device::vram_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -98,8 +98,8 @@ void nubus_m2video_device::device_start()
// printf("[m2video %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_m2video_device::vram_r), this), write32_delegate(FUNC(nubus_m2video_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_m2video_device::vram_r), this), write32_delegate(FUNC(nubus_m2video_device::vram_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -97,8 +97,8 @@ void nubus_radiustpd_device::device_start()
printf("[radiustpd %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_radiustpd_device::vram_r), this), write32_delegate(FUNC(nubus_radiustpd_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_radiustpd_device::vram_r), this), write32_delegate(FUNC(nubus_radiustpd_device::vram_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -99,8 +99,8 @@ void nubus_spec8s3_device::device_start()
// printf("[SPEC8S3 %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_spec8s3_device::vram_r), this), write32_delegate(FUNC(nubus_spec8s3_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_spec8s3_device::vram_r), this), write32_delegate(FUNC(nubus_spec8s3_device::vram_w), this));
m_nubus->install_device(slotspace+0xd0000, slotspace+0xfffff, read32_delegate(FUNC(nubus_spec8s3_device::spec8s3_r), this), write32_delegate(FUNC(nubus_spec8s3_device::spec8s3_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -112,8 +112,8 @@ void nubus_specpdq_device::device_start()
// printf("[specpdq %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_specpdq_device::vram_r), this), write32_delegate(FUNC(nubus_specpdq_device::vram_w), this));
m_nubus->install_device(slotspace+0x400000, slotspace+0xfbffff, read32_delegate(FUNC(nubus_specpdq_device::specpdq_r), this), write32_delegate(FUNC(nubus_specpdq_device::specpdq_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -91,7 +91,7 @@ void nubus_vikbw_device::device_start()
// printf("[vikbw %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram.resize(VRAM_SIZE);
install_bank(slotspace+0x40000, slotspace+0x40000+VRAM_SIZE-1, 0, 0, "bank_vikbw", m_vram);
install_bank(slotspace+0x940000, slotspace+0x940000+VRAM_SIZE-1, 0, 0, "bank_vikbw2", m_vram);

View File

@ -37,7 +37,7 @@ protected:
DECLARE_WRITE32_MEMBER(viking_disable_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 m_vbl_disable, m_palette[2];
};

View File

@ -100,8 +100,8 @@ void nubus_wsportrait_device::device_start()
printf("[wsportrait %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_wsportrait_device::vram_r), this), write32_delegate(FUNC(nubus_wsportrait_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, read32_delegate(FUNC(nubus_wsportrait_device::vram_r), this), write32_delegate(FUNC(nubus_wsportrait_device::vram_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -100,8 +100,8 @@ void nubus_xceed30hr_device::device_start()
// printf("[xceed30hr %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceed30hr_device::vram_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::vram_w), this));
m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -93,8 +93,8 @@ void nubus_cb264se30_device::device_start()
// printf("[cb264se30 %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_cb264se30_device::vram_r), this), write32_delegate(FUNC(nubus_cb264se30_device::vram_w), this));
m_nubus->install_device(slotspace+0xf00000, slotspace+0xfeffff, read32_delegate(FUNC(nubus_cb264se30_device::cb264se30_r), this), write32_delegate(FUNC(nubus_cb264se30_device::cb264se30_w), this));
@ -213,7 +213,7 @@ UINT32 nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32
case 4: // 24 bpp
{
UINT32 *vram32 = (UINT32 *)m_vram;
UINT32 *vram32 = (UINT32 *)&m_vram[0];
UINT32 *base;
for (y = 0; y < 480; y++)

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -96,8 +96,8 @@ void nubus_xceedmc30_device::device_start()
// printf("[xceedmc30 %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceedmc30_device::vram_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::vram_w), this));
m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -99,8 +99,8 @@ void nubus_procolor816_device::device_start()
// printf("[procolor816 %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this));
@ -220,7 +220,7 @@ UINT32 nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb
case 4: // 15 bpp
{
UINT16 *vram16 = (UINT16 *)m_vram;
UINT16 *vram16 = (UINT16 *)&m_vram[0];
UINT16 pixels;
for (y = 0; y < 480; y++)

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable, m_toggle;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;

View File

@ -93,8 +93,8 @@ void nubus_lview_device::device_start()
// printf("[lview %p] slotspace = %x\n", this, slotspace);
m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
m_vram32 = (UINT32 *)m_vram;
m_vram.resize(VRAM_SIZE);
m_vram32 = (UINT32 *)&m_vram[0];
m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this));
m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this));

View File

@ -39,7 +39,7 @@ protected:
DECLARE_WRITE32_MEMBER(vram_w);
public:
UINT8 *m_vram;
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_vbl_disable, m_toggle;
UINT32 m_palette[256];

View File

@ -63,9 +63,9 @@ device_videobrain_expansion_card_interface::~device_videobrain_expansion_card_in
UINT8* device_videobrain_expansion_card_interface::videobrain_rom_pointer(running_machine &machine, size_t size)
{
if (m_rom == NULL)
if (m_rom.count() == 0)
{
m_rom = auto_alloc_array(machine, UINT8, size);
m_rom.resize(size);
m_rom_mask = size - 1;
}
@ -80,9 +80,9 @@ UINT8* device_videobrain_expansion_card_interface::videobrain_rom_pointer(runnin
UINT8* device_videobrain_expansion_card_interface::videobrain_ram_pointer(running_machine &machine, size_t size)
{
if (m_ram == NULL)
if (m_ram.count() == 0)
{
m_ram = auto_alloc_array(machine, UINT8, size);
m_ram.resize(size);
m_ram_mask = size - 1;
}

View File

@ -161,8 +161,8 @@ protected:
videobrain_expansion_slot_device *m_slot;
UINT8 *m_rom;
UINT8 *m_ram;
dynamic_buffer m_rom;
dynamic_buffer m_ram;
size_t m_rom_mask;
size_t m_ram_mask;

View File

@ -172,9 +172,6 @@ void cquestsnd_cpu_device::device_start()
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();
/* Allocate RAM shared with 68000 */
m_sram = auto_alloc_array(machine(), UINT16, 4096/2);
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
m_f = 0;
@ -248,10 +245,6 @@ void cquestsnd_cpu_device::device_reset()
void cquestrot_cpu_device::device_start()
{
/* Allocate RAM */
m_dram = auto_alloc_array(machine(), UINT16, 16384); /* Shared with 68000 */
m_sram = auto_alloc_array(machine(), UINT16, 2048); /* Private */
m_linedata_w.resolve_safe();
m_program = &space(AS_PROGRAM);
@ -375,12 +368,6 @@ void cquestrot_cpu_device::state_string_export(const device_state_entry &entry,
void cquestlin_cpu_device::device_start()
{
/* Allocate RAM */
m_sram = auto_alloc_array(machine(), UINT16, 4096); /* Shared with rotate CPU */
m_ptr_ram = auto_alloc_array(machine(), UINT8, 1024); /* Pointer RAM */
m_e_stack = auto_alloc_array(machine(), UINT32, 32768); /* Stack DRAM: 32kx20 */
m_o_stack = auto_alloc_array(machine(), UINT32, 32768); /* Stack DRAM: 32kx20 */
m_linedata_r.resolve_safe(0);
m_program = &space(AS_PROGRAM);

View File

@ -185,7 +185,7 @@ private:
UINT16 m_dinlatch;
UINT16 m_ramwlatch;
UINT16 *m_sram;
UINT16 m_sram[4096/2];
int m_prev_ipram;
int m_prev_ipwrt;
@ -264,8 +264,8 @@ private:
UINT16 m_linedata;
UINT16 m_lineaddr;
UINT16 *m_dram;
UINT16 *m_sram;
UINT16 m_dram[16384]; /* Shared with 68000 */
UINT16 m_sram[2048]; /* Private */
UINT8 m_prev_dred;
UINT8 m_prev_dwrt;
@ -357,10 +357,10 @@ private:
UINT32 m_clkcnt;
/* RAM */
UINT16 *m_sram;
UINT8 *m_ptr_ram;
UINT32 *m_e_stack;
UINT32 *m_o_stack;
UINT16 m_sram[4096]; /* Shared with rotate CPU */
UINT8 m_ptr_ram[1024]; /* Pointer RAM */
UINT32 m_e_stack[32768]; /* Stack DRAM: 32kx20 */
UINT32 m_o_stack[32768]; /* Stack DRAM: 32kx20 */
address_space *m_program;
direct_read_data *m_direct;

View File

@ -57,7 +57,7 @@ drc_frontend::drc_frontend(device_t &cpu, UINT32 window_start, UINT32 window_end
m_pageshift(m_cpudevice.space_config(AS_PROGRAM)->m_page_shift),
m_desc_live_list(cpu.machine().respool()),
m_desc_allocator(cpu.machine().respool()),
m_desc_array(auto_alloc_array_clear(cpu.machine(), opcode_desc *, window_end + window_start + 2))
m_desc_array(window_end + window_start + 2, true)
{
}
@ -70,9 +70,6 @@ drc_frontend::~drc_frontend()
{
// release any descriptions we've accumulated
release_descriptions();
// free the description array
auto_free(m_cpudevice.machine(), m_desc_array);
}

View File

@ -157,7 +157,7 @@ private:
// opcode descriptor arrays
simple_list<opcode_desc> m_desc_live_list; // list of live descriptions
fixed_allocator<opcode_desc> m_desc_allocator; // fixed allocator for descriptions
opcode_desc ** m_desc_array; // array of descriptions in PC order
dynamic_array<opcode_desc *> m_desc_array; // array of descriptions in PC order
};

View File

@ -294,7 +294,7 @@ drcuml_block::drcuml_block(drcuml_state &drcuml, UINT32 maxinst)
m_next(NULL),
m_nextinst(0),
m_maxinst(maxinst * 3/2),
m_inst(auto_alloc_array(drcuml.device().machine(), instruction, m_maxinst)),
m_inst(m_maxinst),
m_inuse(false)
{
}
@ -306,8 +306,6 @@ drcuml_block::drcuml_block(drcuml_state &drcuml, UINT32 maxinst)
drcuml_block::~drcuml_block()
{
// free the instruction list
auto_free(m_drcuml.device().machine(), m_inst);
}

View File

@ -130,7 +130,7 @@ private:
drcuml_block * m_next; // pointer to next block
UINT32 m_nextinst; // next instruction to fill in the cache
UINT32 m_maxinst; // maximum number of instructions
uml::instruction * m_inst; // pointer to the instruction list
dynamic_array<uml::instruction> m_inst; // pointer to the instruction list
bool m_inuse; // this block is in use
};

View File

@ -187,7 +187,7 @@ void esrip_device::device_start()
m_draw = _config->draw;
/* Allocate image pointer table RAM */
m_ipt_ram = auto_alloc_array(machine(), UINT16, IPT_RAM_SIZE/2);
m_ipt_ram.resize(IPT_RAM_SIZE/2);
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();
@ -291,7 +291,7 @@ void esrip_device::device_start()
save_item(NAME(m_ipt_cnt));
save_item(NAME(m_fig));
save_item(NAME(m_fig_cycles));
save_pointer(NAME(m_ipt_ram), IPT_RAM_SIZE / sizeof(UINT16));
save_item(NAME(m_ipt_ram));
// set our instruction counter
m_icountptr = &m_icount;

View File

@ -195,7 +195,7 @@ protected:
UINT8 m_optable[65536];
UINT16 *m_ipt_ram;
dynamic_array<UINT16> m_ipt_ram;
UINT8 *m_lbrm;
address_space *m_program;

View File

@ -204,12 +204,6 @@ void lc8670_cpu_device::device_start()
m_basetimer->adjust(attotime::from_hz(m_clocks[LC8670_SUB_CLOCK]), 0, attotime::from_hz(m_clocks[LC8670_SUB_CLOCK]));
m_clocktimer = timer_alloc(CLOCK_TIMER);
// alloc internal RAM
m_sfr = auto_alloc_array(machine(), UINT8, 0x80);
m_mram = auto_alloc_array(machine(), UINT8, 0x200);
m_xram = auto_alloc_array(machine(), UINT8, 0xc6);
m_vtrbf = auto_alloc_array(machine(), UINT8, 0x200);
// register state for debugger
state_add(LC8670_PC , "PC" , m_pc).callimport().callexport().formatstr("%04X");
state_add(LC8670_SFR + 0x00, "A" , REG_A ).callimport().callexport().formatstr("%02X");

View File

@ -215,10 +215,10 @@ private:
UINT16 m_pc;
UINT16 m_ppc;
UINT8 m_op;
UINT8 * m_sfr; // special function registers
UINT8 * m_mram; // main RAM
UINT8 * m_xram; // XRAM
UINT8 * m_vtrbf; // work RAM
UINT8 m_sfr[0x80]; // special function registers
UINT8 m_mram[0x200]; // main RAM
UINT8 m_xram[0xc6]; // XRAM
UINT8 m_vtrbf[0x200]; // work RAM
UINT16 m_irq_flag;
UINT8 m_irq_lev;
bool m_after_reti;

View File

@ -387,7 +387,7 @@ void mc68hc11_cpu_device::device_start()
}
}
m_internal_ram = auto_alloc_array(machine(), UINT8, m_internal_ram_size);
m_internal_ram.resize(m_internal_ram_size);
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();
@ -410,7 +410,7 @@ void mc68hc11_cpu_device::device_start()
save_item(NAME(m_has_extended_io));
save_item(NAME(m_internal_ram_size));
save_item(NAME(m_init_value));
save_pointer(NAME(m_internal_ram),m_internal_ram_size);
save_item(NAME(m_internal_ram));
save_item(NAME(m_wait_state));
save_item(NAME(m_stop_state));
save_item(NAME(m_tflg1));

View File

@ -110,7 +110,7 @@ private:
int m_ram_position;
int m_reg_position;
UINT8 *m_internal_ram;
dynamic_buffer m_internal_ram;
int m_has_extended_io; // extended I/O enable flag
int m_internal_ram_size;

View File

@ -254,8 +254,8 @@ void r3000_device::device_start()
}
// allocate cache memory
m_icache = auto_alloc_array(machine(), UINT32, m_icache_size/4);
m_dcache = auto_alloc_array(machine(), UINT32, m_dcache_size/4);
m_icache.resize(m_icache_size/4);
m_dcache.resize(m_dcache_size/4);
m_cache = m_dcache;
m_cache_size = m_dcache_size;
@ -354,8 +354,8 @@ void r3000_device::device_start()
save_item(NAME(m_ppc));
save_item(NAME(m_op));
save_item(NAME(m_interrupt_cycles));
save_pointer(NAME(m_icache), m_icache_size/4);
save_pointer(NAME(m_dcache), m_dcache_size/4);
save_item(NAME(m_icache));
save_item(NAME(m_dcache));
}

View File

@ -249,8 +249,8 @@ protected:
// cache memory
UINT32 * m_cache;
UINT32 * m_icache;
UINT32 * m_dcache;
dynamic_array<UINT32> m_icache;
dynamic_array<UINT32> m_dcache;
size_t m_cache_size;
size_t m_icache_size;
size_t m_dcache_size;

View File

@ -2170,8 +2170,6 @@ INLINE void op1111(sh2_state *sh2, UINT16 opcode)
static CPU_RESET( sh2 )
{
sh2_state *sh2 = get_safe_token(device);
emu_timer *tsave, *tsaved0, *tsaved1;
UINT32 *m;
int (*dma_callback_kludge)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
int (*dma_callback_fifo_data_available)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
int save_is_slave;
@ -2179,11 +2177,6 @@ static CPU_RESET( sh2 )
void (*f)(UINT32 data);
device_irq_acknowledge_callback save_irqcallback;
m = sh2->m;
tsave = sh2->timer;
tsaved0 = sh2->dma_current_active_timer[0];
tsaved1 = sh2->dma_current_active_timer[1];
f = sh2->ftcsr_read_callback;
save_irqcallback = sh2->irq_callback;
save_is_slave = sh2->is_slave;
@ -2210,10 +2203,6 @@ static CPU_RESET( sh2 )
sh2->irq_callback = save_irqcallback;
sh2->device = device;
sh2->timer = tsave;
sh2->dma_current_active_timer[0] = tsaved0;
sh2->dma_current_active_timer[1] = tsaved1;
sh2->m = m;
memset(sh2->m, 0, 0x200);
sh2->pc = RL(sh2, 0);

View File

@ -1007,9 +1007,6 @@ void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_ackno
sh2->dma_current_active_timer[1] = device->machine().scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2);
sh2->dma_current_active_timer[1]->adjust(attotime::never);
sh2->m = auto_alloc_array(device->machine(), UINT32, 0x200/4);
if(conf)
{
sh2->is_slave = conf->is_slave;

View File

@ -130,7 +130,7 @@ struct sh2_state
address_space *program;
direct_read_data *direct;
address_space *internal;
UINT32 *m;
UINT32 m[0x200/4];
INT8 nmi_line_state;
UINT16 frc;

View File

@ -748,17 +748,10 @@ static CPU_EXIT( sh2 )
static CPU_RESET( sh2 )
{
sh2_state *sh2 = get_safe_token(device);
emu_timer *tsave, *tsaved0, *tsaved1;
UINT32 *m;
void (*f)(UINT32 data);
device_irq_acknowledge_callback save_irqcallback;
m = sh2->m;
tsave = sh2->timer;
tsaved0 = sh2->dma_current_active_timer[0];
tsaved1 = sh2->dma_current_active_timer[1];
f = sh2->ftcsr_read_callback;
save_irqcallback = sh2->irq_callback;
@ -779,10 +772,6 @@ static CPU_RESET( sh2 )
sh2->irq_callback = save_irqcallback;
sh2->device = device;
sh2->timer = tsave;
sh2->dma_current_active_timer[0] = tsaved0;
sh2->dma_current_active_timer[1] = tsaved1;
sh2->m = m;
memset(sh2->m, 0, 0x200);
sh2->pc = sh2->program->read_dword(0);

View File

@ -2842,14 +2842,12 @@ static CPU_RESET( common_sh4_reset )
sh4_state *sh4 = get_safe_token(device);
emu_timer *tsaved[4];
emu_timer *tsave[5];
UINT32 *m;
int save_is_slave;
int savecpu_clock, savebus_clock, savepm_clock;
void (*f)(UINT32 data);
device_irq_acknowledge_callback save_irqcallback;
m = sh4->m;
tsaved[0] = sh4->dma_timer[0];
tsaved[1] = sh4->dma_timer[1];
tsaved[2] = sh4->dma_timer[2];
@ -2888,7 +2886,6 @@ static CPU_RESET( common_sh4_reset )
sh4->timer[0] = tsave[2];
sh4->timer[1] = tsave[3];
sh4->timer[2] = tsave[4];
sh4->m = m;
memset(sh4->m, 0, 16384*4);
sh4_default_exception_priorities(sh4);
memset(sh4->exception_requesting, 0, sizeof(sh4->exception_requesting));

View File

@ -1218,8 +1218,6 @@ void sh4_common_init(device_t *device)
sh4->rtc_timer = device->machine().scheduler().timer_alloc(FUNC(sh4_rtc_timer_callback), sh4);
sh4->rtc_timer->adjust(attotime::never);
sh4->m = auto_alloc_array(device->machine(), UINT32, 16384);
}
UINT32 sh4_getsqremap(sh4_state *sh4, UINT32 address)

View File

@ -80,7 +80,7 @@ struct sh4_state
address_space *io;
// sh4 internal
UINT32 *m;
UINT32 m[16384];
// timer regs handled manually for reuse
UINT32 SH4_TSTR;
@ -125,10 +125,6 @@ struct sh4_state
UINT32 SH4_DMAOR;
// sh3 internal
UINT32 m_sh3internal_upper[0x3000/4];
UINT32 m_sh3internal_lower[0x1000];
INT8 nmi_line_state;
UINT8 sleep_mode;
@ -169,6 +165,10 @@ struct sh4_state
int cpu_type;
// sh3 internal
UINT32 m_sh3internal_upper[0x3000/4];
UINT32 m_sh3internal_lower[0x1000];
#ifdef USE_SH4DRC
int icount;

View File

@ -287,7 +287,6 @@ void adsp21062_device::device_start()
build_opcode_table();
m_internal_ram = auto_alloc_array(machine(), UINT16, 2 * 0x10000); // 2x 128KB
m_internal_ram_block0 = &m_internal_ram[0];
m_internal_ram_block1 = &m_internal_ram[0x20000/2];

View File

@ -176,7 +176,6 @@ private:
UINT64 m_px;
UINT16 *m_internal_ram;
UINT16 *m_internal_ram_block0, *m_internal_ram_block1;
address_space *m_program;
@ -213,6 +212,8 @@ private:
UINT32 m_astat_old_old;
UINT32 m_astat_old_old_old;
UINT16 m_internal_ram[2 * 0x10000]; // 2x 128KB
inline void CHANGE_PC(UINT32 newpc);
inline void CHANGE_PC_DELAYED(UINT32 newpc);
void sharc_iop_delayed_w(UINT32 reg, UINT32 data, int cycles);

View File

@ -197,8 +197,6 @@ void tms32082_mp_device::device_start()
state_add(STATE_GENPC, "curpc", m_pc).noshow();
m_param_ram = auto_alloc_array(machine(), UINT32, 0x800);
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();

View File

@ -125,7 +125,7 @@ protected:
UINT32 m_epc;
UINT32 m_eip;
UINT32 *m_param_ram;
UINT32 m_param_ram[0x800];
int m_icount;

View File

@ -13,9 +13,6 @@
#define __34010OPS_H__
/* Size of the memory buffer allocated for the shiftr register */
#define SHIFTREG_SIZE (8 * 512 * sizeof(UINT16))
/***************************************************************************

View File

@ -28,6 +28,9 @@
CORE STATE
***************************************************************************/
/* Size of the memory buffer allocated for the shiftr register */
#define SHIFTREG_SIZE (8 * 512 * sizeof(UINT16))
/* TMS34010 State */
struct XY
{
@ -51,7 +54,6 @@ struct tms34010_state
UINT32 convsp;
UINT32 convdp;
UINT32 convmp;
UINT16 * shiftreg;
INT32 gfxcycles;
UINT8 pixelshift;
UINT8 is_34020;
@ -77,6 +79,7 @@ struct tms34010_state
} regs[31];
UINT16 IOregs[64];
UINT16 shiftreg[SHIFTREG_SIZE/2];
};
INLINE tms34010_state *get_safe_token(device_t *device)
@ -649,13 +652,10 @@ static CPU_INIT( tms34010 )
tms->scantimer = device->machine().scheduler().timer_alloc(FUNC(scanline_callback), tms);
tms->scantimer->adjust(attotime::zero);
/* allocate the shiftreg */
tms->shiftreg = auto_alloc_array(device->machine(), UINT16, SHIFTREG_SIZE/2);
device->save_item(NAME(tms->pc));
device->save_item(NAME(tms->st));
device->save_item(NAME(tms->reset_deferred));
device->save_pointer(NAME(tms->shiftreg), SHIFTREG_SIZE / 2);
device->save_item(NAME(tms->shiftreg));
device->save_item(NAME(tms->IOregs));
device->save_item(NAME(tms->convsp));
device->save_item(NAME(tms->convdp));
@ -672,7 +672,6 @@ static CPU_RESET( tms34010 )
tms34010_state *tms = get_safe_token(device);
const tms34010_config *config = tms->config;
screen_device *screen = tms->screen;
UINT16 *shiftreg = tms->shiftreg;
device_irq_acknowledge_callback save_irqcallback = tms->irq_callback;
emu_timer *save_scantimer = tms->scantimer;
@ -680,7 +679,6 @@ static CPU_RESET( tms34010 )
tms->config = config;
tms->screen = screen;
tms->shiftreg = shiftreg;
tms->irq_callback = save_irqcallback;
tms->scantimer = save_scantimer;
tms->device = device;
@ -714,8 +712,6 @@ static CPU_RESET( tms34020 )
static CPU_EXIT( tms34010 )
{
tms34010_state *tms = get_safe_token(device);
tms->shiftreg = NULL;
}

View File

@ -163,9 +163,6 @@ void tms9995_device::device_start()
assert (conf != NULL);
// Allocate onchip memory
m_onchip_memory = auto_alloc_array(machine(), UINT8, 256);
// TODO: Restore save state suport
m_prgspace = &space(AS_PROGRAM); // dimemory.h

View File

@ -110,7 +110,7 @@ private:
UINT16 PC_debug;
// 256 bytes of onchip memory
UINT8* m_onchip_memory;
UINT8 m_onchip_memory[256];
const address_space_config m_program_config;
const address_space_config m_io_config;

View File

@ -35,10 +35,9 @@ struct vtlb_state
int dynindex; /* index of next dynamic entry */
int pageshift; /* bits to shift to get page index */
int addrwidth; /* logical address bus width */
offs_t * live; /* array of live entries by table index */
int * fixedpages; /* number of pages each fixed entry covers */
vtlb_entry * table; /* table of entries by address */
vtlb_entry * save; /* cache of live table entries for saving */
dynamic_array<offs_t> live; /* array of live entries by table index */
dynamic_array<int> fixedpages; /* number of pages each fixed entry covers */
dynamic_array<vtlb_entry> table; /* table of entries by address */
};
@ -74,18 +73,18 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries,
assert(vtlb->addrwidth > vtlb->pageshift);
/* allocate the entry array */
vtlb->live = auto_alloc_array_clear(cpu->machine(), offs_t, fixed_entries + dynamic_entries);
cpu->save_pointer(NAME(vtlb->live), fixed_entries + dynamic_entries, space);
vtlb->live.resize_and_clear(fixed_entries + dynamic_entries);
cpu->save_item(NAME(vtlb->live));
/* allocate the lookup table */
vtlb->table = auto_alloc_array_clear(cpu->machine(), vtlb_entry, (size_t) 1 << (vtlb->addrwidth - vtlb->pageshift));
cpu->save_pointer(NAME(vtlb->table), 1 << (vtlb->addrwidth - vtlb->pageshift), space);
vtlb->table.resize_and_clear((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift));
cpu->save_item(NAME(vtlb->table));
/* allocate the fixed page count array */
if (fixed_entries > 0)
{
vtlb->fixedpages = auto_alloc_array_clear(cpu->machine(), int, fixed_entries);
cpu->save_pointer(NAME(vtlb->fixedpages), fixed_entries, space);
vtlb->fixedpages.resize_and_clear(fixed_entries);
cpu->save_item(NAME(vtlb->fixedpages));
}
return vtlb;
}

View File

@ -30,10 +30,10 @@ private:
public:
// construction/destruction
dynamic_array(int initial = 0)
dynamic_array(int initial = 0, bool clearit = false)
: m_array(NULL),
m_count(0),
m_allocated(0) { if (initial != 0) expand_internal(initial); m_count = initial; }
m_allocated(0) { if (initial != 0) expand_internal(initial); m_count = initial; if (clearit) clear(); }
virtual ~dynamic_array() { reset(); }
// operators
@ -46,9 +46,15 @@ public:
int count() const { return m_count; }
// helpers
void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; }
const _ElementType &append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; return element; }
void reset() { delete[] m_array; m_array = NULL; m_count = m_allocated = 0; }
void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; }
#ifdef __GNUC__
void clear() { assert(__is_pod(_ElementType)); memset(m_array, 0, m_count * sizeof(*m_array)); }
#else
void clear() { memset(m_array, 0, m_count * sizeof(*m_array)); }
#endif
void resize_and_clear(int count) { resize(count); clear(); }
private:
// internal helpers