Removed most inlines not necessary ... (nw)

On some I wasn't entirely sure :-(
Thanks Vas:
0f0e8853f3 (r31909683)
This commit is contained in:
couriersud 2019-01-12 00:35:08 +01:00
parent a003328dcf
commit b91e3c3a6a
20 changed files with 72 additions and 75 deletions

View File

@ -137,9 +137,9 @@ public:
//NETLIB_RESETI();
NETLIB_UPDATEI();
inline q_type qtype() const { return m_qtype; }
inline bool is_qtype(q_type atype) const { return m_qtype == atype; }
inline void set_qtype(q_type atype) { m_qtype = atype; }
q_type qtype() const { return m_qtype; }
bool is_qtype(q_type atype) const { return m_qtype == atype; }
void set_qtype(q_type atype) { m_qtype = atype; }
protected:
bjt_model_t m_model;

View File

@ -66,14 +66,14 @@ NETLIB_OBJECT(twoterm)
NETLIB_UPDATEI();
public:
/* inline */ void set(const nl_double G, const nl_double V, const nl_double I)
void set(const nl_double G, const nl_double V, const nl_double I)
{
/* GO, GT, I */
m_P.set( G, G, ( V) * G - I);
m_N.set( G, G, ( -V) * G + I);
}
/* inline */ nl_double deltaV() const
nl_double deltaV() const
{
return m_P.net().Q_Analog() - m_N.net().Q_Analog();
}
@ -107,7 +107,7 @@ NETLIB_OBJECT_DERIVED(R_base, twoterm)
}
public:
inline void set_R(const nl_double R)
void set_R(const nl_double R)
{
const nl_double G = NL_FCONST(1.0) / R;
set_mat( G, -G, 0.0,

View File

@ -96,7 +96,7 @@ namespace netlist
m_sub.m_IP.activate_hl();
}
inline NETLIB_FUNC_VOID(CD4020_sub, update_outputs, (const unsigned cnt))
NETLIB_FUNC_VOID(CD4020_sub, update_outputs, (const unsigned cnt))
{
/* static */ const netlist_time out_delayQn[14] = {
NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),

View File

@ -41,7 +41,13 @@ namespace netlist
private:
state_var<netlist_sig_t> m_nextD;
inline void newstate(const netlist_sig_t stateQ, const netlist_sig_t stateQQ);
void newstate(const netlist_sig_t stateQ, const netlist_sig_t stateQQ)
{
// 0: High-to-low 40 ns, 1: Low-to-high 25 ns
static constexpr const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
m_Q.push(stateQ, delay[stateQ]);
m_QQ.push(stateQQ, delay[stateQQ]);
}
};
NETLIB_OBJECT(7474_dip)
@ -74,14 +80,6 @@ namespace netlist
NETLIB_SUB(7474) m_2;
};
inline void NETLIB_NAME(7474)::newstate(const netlist_sig_t stateQ, const netlist_sig_t stateQQ)
{
// 0: High-to-low 40 ns, 1: Low-to-high 25 ns
static constexpr const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
m_Q.push(stateQ, delay[stateQ]);
m_QQ.push(stateQQ, delay[stateQQ]);
}
NETLIB_HANDLER(7474, clk)
{
//if (INP_LH(m_CLK))

View File

@ -105,7 +105,7 @@ namespace netlist
NETLIB_NAME(7483)::update();
}
inline NETLIB_UPDATE(7483)
NETLIB_UPDATE(7483)
{
uint8_t r = static_cast<uint8_t>(m_a + m_b + m_C0());

View File

@ -14,6 +14,7 @@ namespace netlist
{
namespace devices
{
//FIXME: Convert sub devices into NETDEV_DELEGATE logic
NETLIB_OBJECT(9310_subABCD)
{
NETLIB_CONSTRUCTOR(9310_subABCD)

View File

@ -63,8 +63,7 @@ namespace netlist
state_var_u8 m_abcd;
private:
//inline void update_outputs_all(const unsigned &cnt, const netlist_time &out_delay) noexcept
inline void update_outputs_all(const unsigned &cnt, const netlist_time &out_delay) noexcept
void update_outputs_all(const unsigned &cnt, const netlist_time &out_delay) noexcept
{
m_Q[0].push((cnt >> 0) & 1, out_delay);
m_Q[1].push((cnt >> 1) & 1, out_delay);

View File

@ -116,7 +116,7 @@ namespace netlist
/* do nothing */
}
inline NETLIB_FUNC_VOID(Am2847_shifter, shift, (void))
NETLIB_FUNC_VOID(Am2847_shifter, shift, (void))
{
uint32_t out = m_buffer[0] & 1;
uint32_t in = (m_RC() ? out : m_IN());

View File

@ -98,8 +98,17 @@ namespace netlist
state_var<bool> m_last_out;
state_var<bool> m_ff;
inline nl_double clamp(const nl_double v, const nl_double a, const nl_double b);
nl_double clamp(const nl_double v, const nl_double a, const nl_double b)
{
nl_double ret = v;
nl_double vcc = m_R1.m_P();
if (ret > vcc - a)
ret = vcc - a;
if (ret < b)
ret = b;
return ret;
}
};
NETLIB_OBJECT_DERIVED(NE555_dip, NE555)
@ -117,18 +126,6 @@ namespace netlist
}
};
inline nl_double NETLIB_NAME(NE555)::clamp(const nl_double v, const nl_double a, const nl_double b)
{
nl_double ret = v;
nl_double vcc = m_R1.m_P();
if (ret > vcc - a)
ret = vcc - a;
if (ret < b)
ret = b;
return ret;
}
NETLIB_RESET(NE555)
{
m_R1.do_reset();

View File

@ -778,10 +778,10 @@ namespace netlist
logic_net_t(netlist_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
virtual ~logic_net_t();
inline const netlist_sig_t & Q() const NL_NOEXCEPT { return m_cur_Q; }
const netlist_sig_t & Q() const NL_NOEXCEPT { return m_cur_Q; }
void initial(const netlist_sig_t val) NL_NOEXCEPT { m_cur_Q = m_new_Q = val; }
inline void set_Q_and_push(const netlist_sig_t newQ, const netlist_time &delay) NL_NOEXCEPT
void set_Q_and_push(const netlist_sig_t newQ, const netlist_time &delay) NL_NOEXCEPT
{
if (newQ != m_new_Q )
{
@ -789,7 +789,7 @@ namespace netlist
push_to_queue(delay);
}
}
inline void set_Q_and_push_force(const netlist_sig_t newQ, const netlist_time &delay) NL_NOEXCEPT
void set_Q_and_push_force(const netlist_sig_t newQ, const netlist_time &delay) NL_NOEXCEPT
{
if (newQ != m_new_Q || is_queued())
{
@ -798,7 +798,7 @@ namespace netlist
}
}
inline void set_Q_time(const netlist_sig_t newQ, const netlist_time &at) NL_NOEXCEPT
void set_Q_time(const netlist_sig_t newQ, const netlist_time &at) NL_NOEXCEPT
{
if (newQ != m_new_Q)
{
@ -1382,7 +1382,7 @@ namespace netlist
// -----------------------------------------------------------------------------
template <typename ST, std::size_t AW, std::size_t DW>
inline param_rom_t<ST, AW, DW>::param_rom_t(device_t &device, const pstring &name)
param_rom_t<ST, AW, DW>::param_rom_t(device_t &device, const pstring &name)
: param_data_t(device, name)
{
auto f = stream();

View File

@ -40,7 +40,7 @@ public:
template<typename T> struct datatype_f
{
static inline const datatype_t f()
static const datatype_t f()
{
return datatype_t(sizeof(T),
plib::is_integral<T>::value || std::is_enum<T>::value,

View File

@ -25,14 +25,14 @@ namespace plib
template<> struct is_integral<INT128> { static constexpr bool value = true; };
template<> struct numeric_limits<UINT128>
{
static inline constexpr UINT128 max()
static constexpr UINT128 max()
{
return ~((UINT128)0);
}
};
template<> struct numeric_limits<INT128>
{
static inline constexpr INT128 max()
static constexpr INT128 max()
{
return (~((UINT128)0)) >> 1;
}

View File

@ -43,14 +43,14 @@ public:
void add(terminal_t *term, int net_other, bool sorted);
inline std::size_t count() const { return m_terms.size(); }
std::size_t count() const { return m_terms.size(); }
inline terminal_t **terms() { return m_terms.data(); }
inline int *connected_net_idx() { return m_connected_net_idx.data(); }
inline nl_double *gt() { return m_gt.data(); }
inline nl_double *go() { return m_go.data(); }
inline nl_double *Idr() { return m_Idr.data(); }
inline nl_double * const *connected_net_V() const { return m_connected_net_V.data(); }
terminal_t **terms() { return m_terms.data(); }
int *connected_net_idx() { return m_connected_net_idx.data(); }
nl_double *gt() { return m_gt.data(); }
nl_double *go() { return m_go.data(); }
nl_double *Idr() { return m_Idr.data(); }
nl_double * const *connected_net_V() const { return m_connected_net_V.data(); }
void set_pointers();
@ -116,8 +116,8 @@ public:
const netlist_time solve();
void update_inputs();
inline bool has_dynamic_devices() const { return m_dynamic_devices.size() > 0; }
inline bool has_timestep_devices() const { return m_step_devices.size() > 0; }
bool has_dynamic_devices() const { return m_dynamic_devices.size() > 0; }
bool has_timestep_devices() const { return m_step_devices.size() > 0; }
void update_forced();
void update_after(const netlist_time &after)

View File

@ -240,7 +240,7 @@ unsigned matrix_solver_direct_t<m_N, storage_N>::solve_non_dynamic(const bool ne
}
template <std::size_t m_N, std::size_t storage_N>
inline unsigned matrix_solver_direct_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
unsigned matrix_solver_direct_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
build_LE_A<matrix_solver_direct_t>();
build_LE_RHS<matrix_solver_direct_t>();

View File

@ -36,9 +36,9 @@ public:
virtual void vsetup(analog_net_t::list_t &nets) override;
virtual void reset() override { matrix_solver_t::reset(); }
inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
unsigned N() const { if (m_N == 0) return m_dim; else return m_N; }
inline int vsolve_non_dynamic(const bool newton_raphson);
int vsolve_non_dynamic(const bool newton_raphson);
protected:
virtual void add_term(int net_idx, terminal_t *term) override;
@ -139,7 +139,7 @@ protected:
nl_double compute_next_timestep();
template <typename T1, typename T2>
inline nl_ext_double &A(const T1 r, const T2 c) { return m_A[r][c]; }
nl_ext_double &A(const T1 r, const T2 c) { return m_A[r][c]; }
//nl_double m_A[storage_N][((storage_N + 7) / 8) * 8];
nl_double m_RHS[storage_N];
@ -590,7 +590,7 @@ unsigned matrix_solver_direct_t<m_N, storage_N>::solve_non_dynamic(const bool ne
}
template <unsigned m_N, unsigned storage_N>
inline int matrix_solver_direct_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
int matrix_solver_direct_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
this->build_LE_A();
this->build_LE_RHS(m_last_RHS);

View File

@ -192,7 +192,7 @@ unsigned matrix_solver_GMRES_t<m_N, storage_N>::vsolve_non_dynamic(const bool ne
}
template <typename T>
inline static void givens_mult( const T c, const T s, T & g0, T & g1 )
void givens_mult( const T c, const T s, T & g0, T & g1 )
{
const T tg0 = c * g0 - s * g1;
const T tg1 = s * g0 + c * g1;

View File

@ -294,7 +294,7 @@ unsigned matrix_solver_sm_t<m_N, storage_N>::solve_non_dynamic(const bool newton
}
template <std::size_t m_N, std::size_t storage_N>
inline unsigned matrix_solver_sm_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
unsigned matrix_solver_sm_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
build_LE_A<matrix_solver_sm_t>();
build_LE_RHS<matrix_solver_sm_t>();

View File

@ -80,19 +80,19 @@ protected:
template <typename T1, typename T2>
inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; }
nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; }
template <typename T1, typename T2>
inline nl_ext_double &W(const T1 &r, const T2 &c) { return m_W[r][c]; }
nl_ext_double &W(const T1 &r, const T2 &c) { return m_W[r][c]; }
/* access to Ainv for fixed columns over row, there store transposed */
template <typename T1, typename T2>
inline nl_ext_double &Ainv(const T1 &r, const T2 &c) { return m_Ainv[c][r]; }
nl_ext_double &Ainv(const T1 &r, const T2 &c) { return m_Ainv[c][r]; }
template <typename T1>
inline nl_ext_double &RHS(const T1 &r) { return m_RHS[r]; }
nl_ext_double &RHS(const T1 &r) { return m_RHS[r]; }
template <typename T1, typename T2>
inline nl_ext_double &lA(const T1 &r, const T2 &c) { return m_lA[r][c]; }
nl_ext_double &lA(const T1 &r, const T2 &c) { return m_lA[r][c]; }
nl_double m_last_RHS[storage_N]; // right hand side - contains currents
@ -361,7 +361,7 @@ unsigned matrix_solver_w_t<m_N, storage_N>::solve_non_dynamic(const bool newton_
}
template <std::size_t m_N, std::size_t storage_N>
inline unsigned matrix_solver_w_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
unsigned matrix_solver_w_t<m_N, storage_N>::vsolve_non_dynamic(const bool newton_raphson)
{
build_LE_A<matrix_solver_w_t>();
build_LE_RHS<matrix_solver_w_t>();

View File

@ -68,7 +68,7 @@ NETLIB_OBJECT(solver)
void post_start();
void stop();
inline nl_double gmin() { return m_gmin(); }
nl_double gmin() { return m_gmin(); }
void create_solver_code(std::map<pstring, pstring> &mp);

View File

@ -37,7 +37,7 @@ private:
#endif
template<typename T, std::size_t N>
inline static void vec_set (const std::size_t n, const T scalar, T (& RESTRICT v)[N])
void vec_set (const std::size_t n, const T scalar, T (& RESTRICT v)[N])
{
if (n != N)
for ( std::size_t i = 0; i < n; i++ )
@ -48,7 +48,7 @@ inline static void vec_set (const std::size_t n, const T scalar, T (& RESTRICT v
}
template<typename T, std::size_t N>
inline static T vec_mult (const std::size_t n, const T (& RESTRICT v1)[N], const T (& RESTRICT v2)[N] )
T vec_mult (const std::size_t n, const T (& RESTRICT v1)[N], const T (& RESTRICT v2)[N] )
{
T value = 0.0;
if (n != N)
@ -61,7 +61,7 @@ inline static T vec_mult (const std::size_t n, const T (& RESTRICT v1)[N], const
}
template<typename T, std::size_t N>
inline static T vec_mult2 (const std::size_t n, const T (& RESTRICT v)[N])
T vec_mult2 (const std::size_t n, const T (& RESTRICT v)[N])
{
T value = 0.0;
if (n != N)
@ -74,7 +74,7 @@ inline static T vec_mult2 (const std::size_t n, const T (& RESTRICT v)[N])
}
template<typename T, std::size_t N>
inline static void vec_mult_scalar (const std::size_t n, const T (& RESTRICT v)[N], const T & scalar, T (& RESTRICT result)[N])
void vec_mult_scalar (const std::size_t n, const T (& RESTRICT v)[N], const T & scalar, T (& RESTRICT result)[N])
{
if (n != N)
for ( std::size_t i = 0; i < n; i++ )
@ -85,7 +85,7 @@ inline static void vec_mult_scalar (const std::size_t n, const T (& RESTRICT v)[
}
template<typename T, std::size_t N>
inline static void vec_add_mult_scalar (const std::size_t n, const T (& RESTRICT v)[N], const T scalar, T (& RESTRICT result)[N])
void vec_add_mult_scalar (const std::size_t n, const T (& RESTRICT v)[N], const T scalar, T (& RESTRICT result)[N])
{
if (n != N)
for ( std::size_t i = 0; i < n; i++ )
@ -96,20 +96,21 @@ inline static void vec_add_mult_scalar (const std::size_t n, const T (& RESTRICT
}
template<typename T>
inline static void vec_add_mult_scalar_p(const std::size_t & n, const T * RESTRICT v, const T scalar, T * RESTRICT result)
void vec_add_mult_scalar_p(const std::size_t & n, const T * RESTRICT v, const T scalar, T * RESTRICT result)
{
for ( std::size_t i = 0; i < n; i++ )
result[i] += scalar * v[i];
}
inline static void vec_add_ip(const std::size_t n, const double * RESTRICT v, double * RESTRICT result)
template<typename T>
void vec_add_ip(const std::size_t n, const T * RESTRICT v, T * RESTRICT result)
{
for ( std::size_t i = 0; i < n; i++ )
result[i] += v[i];
}
template<typename T, std::size_t N>
inline void vec_sub(const std::size_t n, const T (& RESTRICT v1)[N], const T (& RESTRICT v2)[N], T (& RESTRICT result)[N])
void vec_sub(const std::size_t n, const T (& RESTRICT v1)[N], const T (& RESTRICT v2)[N], T (& RESTRICT result)[N])
{
if (n != N)
for ( std::size_t i = 0; i < n; i++ )
@ -120,7 +121,7 @@ inline void vec_sub(const std::size_t n, const T (& RESTRICT v1)[N], const T (&
}
template<typename T, std::size_t N>
inline void vec_scale(const std::size_t n, T (& RESTRICT v)[N], const T scalar)
void vec_scale(const std::size_t n, T (& RESTRICT v)[N], const T scalar)
{
if (n != N)
for ( std::size_t i = 0; i < n; i++ )
@ -130,9 +131,10 @@ inline void vec_scale(const std::size_t n, T (& RESTRICT v)[N], const T scalar)
v[i] = scalar * v[i];
}
inline double vec_maxabs(const std::size_t n, const double * RESTRICT v)
template<typename T>
T vec_maxabs(const std::size_t n, const T * RESTRICT v)
{
double ret = 0.0;
T ret = 0.0;
for ( std::size_t i = 0; i < n; i++ )
ret = std::max(ret, std::abs(v[i]));