mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/benchmark: fix divide by zero if runs < 1000
If runs < 1000, `runs / 1000` will result in 0 - which causes a division by 0.
This commit is contained in:
parent
865df2056b
commit
5833bcb7ba
@ -26,7 +26,7 @@
|
||||
void benchmark_print_time(uint32_t time, unsigned long runs, const char *name)
|
||||
{
|
||||
uint32_t full = (time / runs);
|
||||
uint32_t div = (time - (full * runs)) / (runs / 1000);
|
||||
uint32_t div = (time - (full * runs)) * 1000 / runs;
|
||||
|
||||
uint32_t per_sec = (uint32_t)(((uint64_t)US_PER_SEC * runs) / time);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user