mirror of
https://github.com/holub/mame
synced 2025-10-08 09:30:17 +03:00
Retired min/max in attotime.h, in favor of std::[min|max]()
This commit is contained in:
parent
104fe318ac
commit
1617d0ab27
@ -301,25 +301,6 @@ inline constexpr bool operator>=(const attotime &left, const attotime &right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// min - return the minimum of two attotimes
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
inline constexpr attotime min(const attotime &left, const attotime &right)
|
|
||||||
{
|
|
||||||
return (left.m_seconds > right.m_seconds) ? right : (left.m_seconds < right.m_seconds) ? left : (left.m_attoseconds > right.m_attoseconds) ? right : left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// max - return the maximum of two attotimes
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
inline constexpr attotime max(const attotime &left, const attotime &right)
|
|
||||||
{
|
|
||||||
return (left.m_seconds > right.m_seconds) ? left : (left.m_seconds < right.m_seconds) ? right : (left.m_attoseconds > right.m_attoseconds) ? left : right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convert to an attoseconds value, clamping to +/- 1 second */
|
/** Convert to an attoseconds value, clamping to +/- 1 second */
|
||||||
inline constexpr attoseconds_t attotime::as_attoseconds() const
|
inline constexpr attoseconds_t attotime::as_attoseconds() const
|
||||||
{
|
{
|
||||||
|
@ -506,7 +506,7 @@ void device_scheduler::timeslice()
|
|||||||
// if the new local CPU time is less than our target, move the target up, but not before the base
|
// if the new local CPU time is less than our target, move the target up, but not before the base
|
||||||
if (exec->m_localtime < target)
|
if (exec->m_localtime < target)
|
||||||
{
|
{
|
||||||
target = max(exec->m_localtime, m_basetime);
|
target = std::max(exec->m_localtime, m_basetime);
|
||||||
LOG((" (new target)\n"));
|
LOG((" (new target)\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,11 +758,11 @@ void device_scheduler::rebuild_execute_list()
|
|||||||
if (!device->interface(exec))
|
if (!device->interface(exec))
|
||||||
fatalerror("Device '%s' specified for perfect interleave is not an executing device!\n", machine().config().m_perfect_cpu_quantum.c_str());
|
fatalerror("Device '%s' specified for perfect interleave is not an executing device!\n", machine().config().m_perfect_cpu_quantum.c_str());
|
||||||
|
|
||||||
min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum);
|
min_quantum = std::min(attotime(0, exec->minimum_quantum()), min_quantum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure it's no higher than 60Hz
|
// make sure it's no higher than 60Hz
|
||||||
min_quantum = min(min_quantum, attotime::from_hz(60));
|
min_quantum = std::min(min_quantum, attotime::from_hz(60));
|
||||||
|
|
||||||
// inform the timer system of our decision
|
// inform the timer system of our decision
|
||||||
add_scheduling_quantum(min_quantum, attotime::never);
|
add_scheduling_quantum(min_quantum, attotime::never);
|
||||||
@ -951,7 +951,7 @@ void device_scheduler::add_scheduling_quantum(const attotime &quantum, const att
|
|||||||
|
|
||||||
// if we found an exact match, just take the maximum expiry time
|
// if we found an exact match, just take the maximum expiry time
|
||||||
if (insert_after != nullptr && insert_after->m_requested == quantum_attos)
|
if (insert_after != nullptr && insert_after->m_requested == quantum_attos)
|
||||||
insert_after->m_expire = max(insert_after->m_expire, expire);
|
insert_after->m_expire = std::max(insert_after->m_expire, expire);
|
||||||
|
|
||||||
// otherwise, allocate a new quantum and insert it after the one we picked
|
// otherwise, allocate a new quantum and insert it after the one we picked
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user