summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/analog/nlid_twoterm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/analog/nlid_twoterm.h')
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h
index 5571e17867d..aa165d58a4e 100644
--- a/src/lib/netlist/analog/nlid_twoterm.h
+++ b/src/lib/netlist/analog/nlid_twoterm.h
@@ -33,9 +33,9 @@
#ifndef NLID_TWOTERM_H_
#define NLID_TWOTERM_H_
+#include "../plib/pfunction.h"
#include "netlist/nl_base.h"
#include "netlist/nl_setup.h"
-#include "../plib/pfunction.h"
// -----------------------------------------------------------------------------
// Implementation
@@ -52,12 +52,13 @@ namespace netlist
template <class C>
inline core_device_t &bselect(bool b, C &d1, core_device_t &d2)
{
- core_device_t *h = dynamic_cast<core_device_t *>(&d1);
+ auto *h = dynamic_cast<core_device_t *>(&d1);
return b ? *h : d2;
}
template<>
inline core_device_t &bselect(bool b, netlist_base_t &d1, core_device_t &d2)
{
+ plib::unused_var(d1);
if (b)
throw nl_exception("bselect with netlist and b==true");
return d2;
@@ -66,11 +67,9 @@ namespace netlist
NETLIB_OBJECT(twoterm)
{
NETLIB_CONSTRUCTOR_EX(twoterm, bool terminals_owned = false)
- , m_P(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "1")
- , m_N(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "2")
+ , m_P(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "1", &m_N)
+ , m_N(bselect(terminals_owned, owner, *this), (terminals_owned ? name + "." : "") + "2", &m_P)
{
- m_P.m_otherterm = &m_N;
- m_N.m_otherterm = &m_P;
}
terminal_t m_P;
@@ -124,7 +123,7 @@ NETLIB_OBJECT_DERIVED(R_base, twoterm)
public:
void set_R(const nl_double R)
{
- const nl_double G = NL_FCONST(1.0) / R;
+ const nl_double G = plib::constants<nl_double>::one / R;
set_mat( G, -G, 0.0,
-G, G, 0.0);
}
@@ -166,7 +165,7 @@ NETLIB_OBJECT(POT)
, m_R2(*this, "_R2")
, m_R(*this, "R", 10000)
, m_Dial(*this, "DIAL", 0.5)
- , m_DialIsLog(*this, "DIALLOG", 0)
+ , m_DialIsLog(*this, "DIALLOG", false)
{
register_subalias("1", m_R1.m_P);
register_subalias("2", m_R1.m_N);
@@ -195,8 +194,8 @@ NETLIB_OBJECT(POT2)
, m_R1(*this, "_R1")
, m_R(*this, "R", 10000)
, m_Dial(*this, "DIAL", 0.5)
- , m_DialIsLog(*this, "DIALLOG", 0)
- , m_Reverse(*this, "REVERSE", 0)
+ , m_DialIsLog(*this, "DIALLOG", false)
+ , m_Reverse(*this, "REVERSE", false)
{
register_subalias("1", m_R1.m_P);
register_subalias("2", m_R1.m_N);
@@ -489,7 +488,7 @@ private:
};
- } //namespace devices
+ } // namespace analog
} // namespace netlist
#endif /* NLD_TWOTERM_H_ */