From: Michel Pollet Date: Fri, 15 Sep 2017 09:17:32 +0000 (+0100) Subject: timer: Removed round() X-Git-Tag: v1.6~20 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=f71135f1f02bd2e2dcfcbd64c91c5e4a392a532a;p=sx%2Fsimavr.git timer: Removed round() That drags libm in, and we don't need that. Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index fede329..d430aa2 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -457,7 +457,8 @@ avr_timer_configure( if (prescaler != 0) resulting_clock = p->ext_clock / prescaler; tov_cycles_exact = (float)avr->frequency / p->ext_clock * prescaler * (top+1); - p->tov_cycles = round(tov_cycles_exact); + // p->tov_cycles = round(tov_cycles_exact); -- don't want libm! + p->tov_cycles = tov_cycles_exact + .5f; // Round to integer p->tov_cycles_fract = tov_cycles_exact - p->tov_cycles; } }