From dff0ef183bc60ff84535022fb17f3e27c6a0718d Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Thu, 7 Jun 2018 20:15:39 -0500 Subject: [PATCH] Fix type cast for NV2A ptimer. --- src/devices/video/EmuNV2A_PTIMER.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/devices/video/EmuNV2A_PTIMER.cpp b/src/devices/video/EmuNV2A_PTIMER.cpp index db3b0777b..c78ea1554 100644 --- a/src/devices/video/EmuNV2A_PTIMER.cpp +++ b/src/devices/video/EmuNV2A_PTIMER.cpp @@ -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; rh = (uint64_t)u.l.high * (uint64_t)b; rh += (rl >> 32); - res.l.high = rh / c; + res.l.high = (uint32_t)rh / c; res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; 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) { // Get time in nanoseconds - long int time = static_cast(std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count()); + uint64_t time = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); 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); }