mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
More STL. (nw)
This commit is contained in:
parent
9a043e8d96
commit
1a108bfd28
@ -67,7 +67,7 @@ UINT32 truthtable_desc_t::get_ignored_extended(UINT32 i)
|
||||
* may change the output
|
||||
*/
|
||||
UINT32 bits = (1<<count_bits(nign));
|
||||
plib::array_t<int> t(bits);
|
||||
std::vector<int> t(bits);
|
||||
|
||||
for (UINT32 j=1; j<bits; j++)
|
||||
{
|
||||
@ -103,7 +103,7 @@ UINT32 truthtable_desc_t::get_ignored_extended(UINT32 i)
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
void truthtable_desc_t::help(unsigned cur, plib::pstring_vector_t list,
|
||||
UINT64 state,UINT16 val, plib::array_t<UINT8> &timing_index)
|
||||
UINT64 state,UINT16 val, std::vector<UINT8> &timing_index)
|
||||
{
|
||||
pstring elem = list[cur].trim();
|
||||
int start = 0;
|
||||
@ -178,7 +178,7 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, UINT32 d
|
||||
nl_assert_always(times.size() == m_NO, "timing count not matching");
|
||||
|
||||
UINT16 val = 0;
|
||||
plib::array_t<UINT8> tindex(m_NO);
|
||||
std::vector<UINT8> tindex;
|
||||
|
||||
for (unsigned j=0; j<m_NO; j++)
|
||||
{
|
||||
@ -192,7 +192,7 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, UINT32 d
|
||||
while (m_timing_nt[k] != netlist_time::zero && m_timing_nt[k] != t)
|
||||
k++;
|
||||
m_timing_nt[k] = t;
|
||||
tindex[j] = k;
|
||||
tindex.push_back(k); //[j] = k;
|
||||
}
|
||||
|
||||
help(0, inout, 0 , val, tindex);
|
||||
@ -204,10 +204,7 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, UINT32 d
|
||||
}
|
||||
|
||||
// determine ignore
|
||||
plib::array_t<UINT32> ign(m_size);
|
||||
|
||||
for (UINT32 j=0; j < m_size; j++)
|
||||
ign[j] = ~0U;
|
||||
std::vector<UINT32> ign(m_size, ~0U);
|
||||
|
||||
for (UINT32 i=0; i<m_size; i++)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ struct truthtable_desc_t
|
||||
|
||||
private:
|
||||
void help(unsigned cur, plib::pstring_vector_t list,
|
||||
UINT64 state,UINT16 val, plib::array_t<UINT8> &timing_index);
|
||||
UINT64 state,UINT16 val, std::vector<UINT8> &timing_index);
|
||||
static unsigned count_bits(UINT32 v);
|
||||
static UINT32 set_bits(UINT32 v, UINT32 b);
|
||||
UINT32 get_ignored_simple(UINT32 i);
|
||||
|
@ -1053,8 +1053,8 @@ namespace netlist
|
||||
private:
|
||||
struct names_t { char m_buf[64]; };
|
||||
int m_qsize;
|
||||
plib::array_t<netlist_time::INTERNALTYPE> m_times;
|
||||
plib::array_t<names_t> m_names;
|
||||
std::vector<netlist_time::INTERNALTYPE> m_times;
|
||||
std::vector<names_t> m_names;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -126,7 +126,7 @@ namespace netlist
|
||||
volatile std::atomic<int> m_lock;
|
||||
#endif
|
||||
entry_t * m_end;
|
||||
plib::array_t<entry_t> m_list;
|
||||
std::vector<entry_t> m_list;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -15,78 +15,13 @@
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <array>
|
||||
|
||||
#include "palloc.h"
|
||||
#include "pstring.h"
|
||||
|
||||
namespace plib {
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// parray_t: dynamic array
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
template <class LC>
|
||||
class array_t
|
||||
{
|
||||
public:
|
||||
|
||||
ATTR_COLD array_t(std::size_t numElements)
|
||||
: m_list(0), m_capacity(0)
|
||||
{
|
||||
set_capacity(numElements);
|
||||
}
|
||||
|
||||
ATTR_COLD array_t(const array_t &rhs)
|
||||
: m_list(0), m_capacity(0)
|
||||
{
|
||||
set_capacity(rhs.size());
|
||||
for (std::size_t i=0; i<m_capacity; i++)
|
||||
m_list[i] = rhs[i];
|
||||
}
|
||||
|
||||
ATTR_COLD array_t &operator=(const array_t &rhs)
|
||||
{
|
||||
set_capacity(rhs.size());
|
||||
for (std::size_t i=0; i<m_capacity; i++)
|
||||
m_list[i] = rhs[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
~array_t()
|
||||
{
|
||||
if (m_list != nullptr)
|
||||
pfree_array(m_list);
|
||||
m_list = nullptr;
|
||||
}
|
||||
|
||||
ATTR_HOT LC& operator[](const std::size_t index) { return m_list[index]; }
|
||||
ATTR_HOT const LC& operator[](const std::size_t index) const { return m_list[index]; }
|
||||
|
||||
ATTR_HOT std::size_t size() const { return m_capacity; }
|
||||
|
||||
void resize(const std::size_t new_size)
|
||||
{
|
||||
set_capacity(new_size);
|
||||
}
|
||||
|
||||
protected:
|
||||
ATTR_COLD void set_capacity(const std::size_t new_capacity)
|
||||
{
|
||||
if (m_list != nullptr)
|
||||
pfree_array(m_list);
|
||||
if (new_capacity > 0)
|
||||
m_list = palloc_array<LC>(new_capacity);
|
||||
else
|
||||
m_list = nullptr;
|
||||
m_capacity = new_capacity;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
LC * m_list;
|
||||
int m_capacity;
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------------------------------------
|
||||
* uninitialised_array_t:
|
||||
* fixed size array allowing to override constructor and initialize
|
||||
@ -637,7 +572,7 @@ private:
|
||||
|
||||
}
|
||||
pvector_t<element_t> m_values;
|
||||
array_t<int> m_hash;
|
||||
std::vector<int> m_hash;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user