From 68b1302585b8f7659a88536e626fd96b79ef325b Mon Sep 17 00:00:00 2001 From: messani Date: Fri, 28 Oct 2016 12:47:29 +0200 Subject: [PATCH] casting to uint64_t instead of float --- simavr/sim/avr_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]; } -- 2.39.5