summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/prandom.h
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-05-03 23:37:44 +0200
committer couriersud <couriersud@gmx.org>2020-05-04 09:22:16 +0200
commitb500f2d24175ff2bd8efdb889a6c5eea12e96314 (patch)
tree5fff1c55603387a2258b830cab01ac21ac6e43b9 /src/lib/netlist/plib/prandom.h
parente59af6d5e89f02a2a626adc95b244924403b98f9 (diff)
netlist: Restructered the save state system. (nw)
This change makes state saving contract based. Objects which need to save state need to have the following template member: template <typename ST> void save_state(ST &st) { /* Example */ st.save_item(m_p, "m_p"); st.save_item(m_buf, "m_buf"); } This member function is called when the object is passed to the state manager save function.
Diffstat (limited to 'src/lib/netlist/plib/prandom.h')
-rw-r--r--src/lib/netlist/plib/prandom.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/netlist/plib/prandom.h b/src/lib/netlist/plib/prandom.h
index 8c607719930..c5d363b2f5c 100644
--- a/src/lib/netlist/plib/prandom.h
+++ b/src/lib/netlist/plib/prandom.h
@@ -52,11 +52,11 @@ namespace plib
static constexpr T min() noexcept { return static_cast<T>(0); }
static constexpr T max() noexcept { return ~T(0) >> (sizeof(T)*8 - w); }
- template <typename ST, typename STR>
- void save_state(ST &st, const STR &name)
+ template <typename ST>
+ void save_state(ST &st)
{
- st.save_item(m_p, name, "index");
- st.save_item(m_mt, name, "mt");
+ st.save_item(m_p, "index");
+ st.save_item(m_mt, "mt");
}
void seed(T val) noexcept
@@ -142,9 +142,10 @@ namespace plib
* constants<FT>::sqrt3() * m_stddev;
}
- template <typename ST, typename STR>
- void save_state(ST &st, const STR &name)
+ template <typename ST>
+ void save_state(ST &st)
{
+ plib::unused_var(st);
/* no state to save */
}
@@ -169,11 +170,11 @@ namespace plib
return m_buf[m_p++];
}
- template <typename ST, typename STR>
- void save_state(ST &st, const STR &name)
+ template <typename ST>
+ void save_state(ST &st)
{
- st.save_item(m_p, name, "m_p");
- st.save_item(m_buf, name, "m_buf");
+ st.save_item(m_p, "m_p");
+ st.save_item(m_buf, "m_buf");
}
private: