From: messani Date: Fri, 28 Oct 2016 10:47:29 +0000 (+0200) Subject: casting to uint64_t instead of float X-Git-Tag: v1.4~9^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=68b1302585b8f7659a88536e626fd96b79ef325b;p=sx%2Fsimavr.git casting to uint64_t instead of float --- diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 903c654..fc5e495 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -462,7 +462,7 @@ avr_timer_write( // to be synced. To obtain better simulation results // p->tov_base type must be float or avr->frequency // must be multiple of 32768. - p->cs_div_value = (uint32_t)((float)avr->frequency * (1 << p->cs_div[new_cs]) / 32768); + p->cs_div_value = (uint32_t)((uint64_t)avr->frequency * (1 << p->cs_div[new_cs]) / 32768); } else { p->cs_div_value = 1 << p->cs_div[new_cs]; }