magic numbers are bad, untested changes are worse (nw)

This commit is contained in:
Vas Crabb 2019-02-23 01:17:16 +11:00
parent 10f2953b65
commit 71d7a8ff68
2 changed files with 14 additions and 20 deletions

View File

@ -69,21 +69,15 @@ DEFINE_DEVICE_TYPE(MK48T12, mk48t12_device, "mk48t12", "MK48T12 Timekeeper")
INLINE FUNCTIONS INLINE FUNCTIONS
***************************************************************************/ ***************************************************************************/
static void counter_to_ram(u8 *data, u32 offset, u8 counter) inline void counter_to_ram(u8 *data, s32 offset, u8 counter)
{ {
if (offset >= 0) if (offset >= 0)
{
data[offset] = counter; data[offset] = counter;
} }
}
static int counter_from_ram(u8 *data, u32 offset) inline int counter_from_ram(u8 const *data, s32 offset, u8 unmap = 0)
{ {
if (offset >= 0) return (offset >= 0) ? data[offset] : unmap;
{
return data[offset];
}
return 0;
} }
//************************************************************************** //**************************************************************************

View File

@ -79,17 +79,17 @@ private:
attotime m_watchdog_delay; attotime m_watchdog_delay;
protected: protected:
u32 const m_size; u32 const m_size;
u32 m_offset_watchdog; s32 m_offset_watchdog;
u32 m_offset_control; s32 m_offset_control;
u32 m_offset_seconds; s32 m_offset_seconds;
u32 m_offset_minutes; s32 m_offset_minutes;
u32 m_offset_hours; s32 m_offset_hours;
u32 m_offset_day; s32 m_offset_day;
u32 m_offset_date; s32 m_offset_date;
u32 m_offset_month; s32 m_offset_month;
u32 m_offset_year; s32 m_offset_year;
u32 m_offset_century; s32 m_offset_century;
u32 m_offset_flags; s32 m_offset_flags;
}; };
class m48t02_device : public timekeeper_device class m48t02_device : public timekeeper_device