mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
xtal: Compensate for floating-point rounding errors when converting to integer value (nw)
This commit is contained in:
parent
f5d8c0f504
commit
10232447ba
@ -49,7 +49,7 @@ public:
|
|||||||
constexpr explicit XTAL(double base_clock) : m_base_clock(base_clock), m_current_clock(base_clock) {}
|
constexpr explicit XTAL(double base_clock) : m_base_clock(base_clock), m_current_clock(base_clock) {}
|
||||||
|
|
||||||
constexpr double dvalue() const noexcept { return m_current_clock; }
|
constexpr double dvalue() const noexcept { return m_current_clock; }
|
||||||
constexpr u32 value() const noexcept { return u32(m_current_clock); }
|
constexpr u32 value() const noexcept { return u32(m_current_clock + 1e-3); }
|
||||||
constexpr double base() const noexcept { return m_base_clock; }
|
constexpr double base() const noexcept { return m_base_clock; }
|
||||||
|
|
||||||
template <typename T> constexpr XTAL operator *(T &&mult) const noexcept { return XTAL(m_base_clock, m_current_clock * mult); }
|
template <typename T> constexpr XTAL operator *(T &&mult) const noexcept { return XTAL(m_base_clock, m_current_clock * mult); }
|
||||||
|
Loading…
Reference in New Issue
Block a user