Use tabledivide64() in timerUpdate()

git-svn-id: https://svn.eduke32.com/eduke32@8136 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-10-19 23:41:22 +00:00 committed by Christoph Oelckers
parent b298ed19ff
commit 4c4ffa80b4

View file

@ -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;