From 4c4ffa80b4cdb183ccd1e9466420e474f6b34c7d Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 19 Oct 2019 23:41:22 +0000 Subject: [PATCH] Use tabledivide64() in timerUpdate() git-svn-id: https://svn.eduke32.com/eduke32@8136 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/timer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/build/src/timer.cpp b/source/build/src/timer.cpp index 643b93062..2507c7e6f 100644 --- a/source/build/src/timer.cpp +++ b/source/build/src/timer.cpp @@ -40,8 +40,9 @@ ATTRIBUTE((flatten)) void timerUpdate(void) auto elapsedTime = time - timerlastsample; uint64_t numerator = (elapsedTime.count() * (uint64_t) timerticspersec * steady_clock::period::num); - int n = numerator / timerGetFreqU64(); - totalclock.setFraction(((numerator - n*timerGetFreqU64()) * 65536) / timerGetFreqU64()); + uint64_t freq = timerGetFreqU64(); + int n = tabledivide64(numerator, freq); + totalclock.setFraction(tabledivide64((numerator - n*timerGetFreqU64()) * 65536, freq)); if (n <= 0) return;