Fix type cast for NV2A ptimer.
This commit is contained in:
parent
be049defa9
commit
dff0ef183b
|
@ -12,7 +12,7 @@ static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
|
||||||
rl = (uint64_t)u.l.low * (uint64_t)b;
|
rl = (uint64_t)u.l.low * (uint64_t)b;
|
||||||
rh = (uint64_t)u.l.high * (uint64_t)b;
|
rh = (uint64_t)u.l.high * (uint64_t)b;
|
||||||
rh += (rl >> 32);
|
rh += (rl >> 32);
|
||||||
res.l.high = rh / c;
|
res.l.high = (uint32_t)rh / c;
|
||||||
res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
|
res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
|
||||||
return res.ll;
|
return res.ll;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,10 @@ static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
|
||||||
static uint64_t ptimer_get_clock(NV2AState * d)
|
static uint64_t ptimer_get_clock(NV2AState * d)
|
||||||
{
|
{
|
||||||
// Get time in nanoseconds
|
// Get time in nanoseconds
|
||||||
long int time = static_cast<long int>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
uint64_t time = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
|
||||||
|
|
||||||
return muldiv64(time,
|
return muldiv64(time,
|
||||||
d->pramdac.core_clock_freq * d->ptimer.numerator,
|
uint32_t(d->pramdac.core_clock_freq * d->ptimer.numerator),
|
||||||
CLOCKS_PER_SEC * d->ptimer.denominator);
|
CLOCKS_PER_SEC * d->ptimer.denominator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue