Commit 68b1302585b8f7659a88536e626fd96b79ef325b
authormessani <messani@gmail.com>
Fri, 28 Oct 2016 10:47:29 +0000 (12:47 +0200)
committerGitHub <noreply@github.com>
Fri, 28 Oct 2016 10:47:29 +0000 (12:47 +0200)
simavr/sim/avr_timer.c

index 903c6547b71d43f5b723abe42e3afe926e62b2aa..fc5e4953baaf56a0686927a683faaf545456723d 100644 (file)
@@ -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];
                }