1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/benchmark: fix integer overflow in benchmark_print_time()

This commit is contained in:
LP-HAW 2023-10-13 18:19:41 +02:00
parent 3a4ec8d21e
commit 568cbc0cde

View File

@ -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)) * 1000 / runs;
uint32_t div = (uint32_t)(((uint64_t)(time - (full * runs))) * 1000 / runs);
uint32_t per_sec = (uint32_t)(((uint64_t)US_PER_SEC * runs) / time);