summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/sh4/sh4comn.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-02-03 07:52:45 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-02-03 07:52:45 +0000
commit1e88333178b63ee0d5b914e181b19b3b161f807b (patch)
treeff1d59069ab151d3ea122c8a26931305157f9d17 /src/emu/cpu/sh4/sh4comn.c
parent78005b8ffeaf34d10565466d794debf7f5d2ff73 (diff)
Converted attotime to a class, with proper operators. Removed old
global functions which are now superceded by the operators and methods on the class. [Aaron Giles] Required mappings are: attotime_make(a,b) => attotime(a,b) attotime_to_double(t) => t.as_double() double_to_attotime(d) => attotime::from_double(d) attotime_to_attoseconds(t) => t.as_attoseconds() attotime_to_ticks(t,f) => t.as_ticks(f) ticks_to_attotime(t,f) => attotime::from_ticks(t,f) attotime_add(a,b) => a + b attotime_add_attoseconds(a,b) => a + attotime(0, b) attotime_sub(a,b) => a - b attotime_sub_attoseconds(a,b) => a - attotime(0, b) attotime_compare(a,b) == 0 => a == b attotime_compare(a,b) != 0 => a != b attotime_compare(a,b) < 0 => a < b attotime_compare(a,b) <= 0 => a <= b attotime_compare(a,b) > 0 => a > b attotime_compare(a,b) >= 0 => a >= b attotime_mul(a,f) => a * f attotime_div(a,f) => a / f attotime_min(a,b) => min(a,b) attotime_max(a,b) => max(a,b) attotime_is_never(t) => t.is_never() attotime_string(t,p) => t.as_string(p) In addition, some existing #defines still exist but will go away: attotime_zero => attotime::zero attotime_never => attotime::never ATTOTIME_IN_SEC(s) => attotime::from_seconds(s) ATTOTIME_IN_MSEC(m) => attotime::from_msec(m) ATTOTIME_IN_USEC(u) => attotime::from_usec(u) ATTOTIME_IN_NSEC(n) => attotime::from_nsec(n) ATTOTIME_IN_HZ(h) => attotime::from_hz(h)
Diffstat (limited to 'src/emu/cpu/sh4/sh4comn.c')
-rw-r--r--src/emu/cpu/sh4/sh4comn.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c
index 0180bfca84c..6deae7852d9 100644
--- a/src/emu/cpu/sh4/sh4comn.c
+++ b/src/emu/cpu/sh4/sh4comn.c
@@ -212,7 +212,7 @@ static UINT32 compute_ticks_refresh_timer(emu_timer *timer, int hertz, int base,
// elapsed:total = x : ticks
// x=elapsed*tics/total -> x=elapsed*(double)100000000/rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]
// ticks/total=ticks / ((rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] * ticks) / 100000000)=1/((rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] / 100000000)=100000000/rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]
- return base + (UINT32)((attotime_to_double(timer_timeelapsed(timer)) * (double)hertz) / (double)divisor);
+ return base + (UINT32)((timer_timeelapsed(timer).as_double() * (double)hertz) / (double)divisor);
}
static void sh4_refresh_timer_recompute(sh4_state *sh4)
@@ -224,7 +224,7 @@ UINT32 ticks;
ticks = sh4->m[RTCOR]-sh4->m[RTCNT];
if (ticks <= 0)
ticks = 256 + ticks;
- timer_adjust_oneshot(sh4->refresh_timer, attotime_mul(attotime_mul(ATTOTIME_IN_HZ(sh4->bus_clock), rtcnt_div[(sh4->m[RTCSR] >> 3) & 7]), ticks), 0);
+ timer_adjust_oneshot(sh4->refresh_timer, attotime::from_hz(sh4->bus_clock) * rtcnt_div[(sh4->m[RTCSR] >> 3) & 7] * ticks, 0);
sh4->refresh_timer_base = sh4->m[RTCNT];
}
@@ -235,14 +235,14 @@ UINT32 ticks;
INLINE attotime sh4_scale_up_mame_time(attotime _time1, UINT32 factor1)
{
- return attotime_add(attotime_mul(_time1, factor1), _time1);
+ return _time1 * factor1 + _time1;
}
static UINT32 compute_ticks_timer(emu_timer *timer, int hertz, int divisor)
{
double ret;
- ret=((attotime_to_double(timer_timeleft(timer)) * (double)hertz) / (double)divisor) - 1;
+ ret=((timer_timeleft(timer).as_double() * (double)hertz) / (double)divisor) - 1;
return (UINT32)ret;
}
@@ -251,7 +251,7 @@ static void sh4_timer_recompute(sh4_state *sh4, int which)
double ticks;
ticks = sh4->m[tcnt[which]];
- timer_adjust_oneshot(sh4->timer[which], sh4_scale_up_mame_time(attotime_mul(ATTOTIME_IN_HZ(sh4->pm_clock), tcnt_div[sh4->m[tcr[which]] & 7]), ticks), which);
+ timer_adjust_oneshot(sh4->timer[which], sh4_scale_up_mame_time(attotime::from_hz(sh4->pm_clock) * tcnt_div[sh4->m[tcr[which]] & 7], ticks), which);
}
static TIMER_CALLBACK( sh4_refresh_timer_callback )