Commit f71135f1f02bd2e2dcfcbd64c91c5e4a392a532a
authorMichel Pollet <buserror@gmail.com>
Fri, 15 Sep 2017 09:17:32 +0000 (10:17 +0100)
committerMichel Pollet <buserror@gmail.com>
Fri, 15 Sep 2017 09:17:32 +0000 (10:17 +0100)
That drags libm in, and we don't need that.

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/avr_timer.c

index fede329aff0bc9d6d88da03c3362f511c26af20f..d430aa2d05db61df225fc8ba040c0fbf387e0bec 100644 (file)
@@ -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;
                }
        }