cmd: mtd: benchmark: use lldiv() instead of 64-bit division
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Sat, 1 Nov 2025 06:24:23 +0000 (09:24 +0300)
committerMichael Trimarchi <michael@amarulasolutions.com>
Tue, 18 Nov 2025 19:06:21 +0000 (20:06 +0100)
commit5572d9410074b56ad25d35b0d3e17c93d8dbaeb0
treebe0436d6ebd2e5cceaeabd16cae126dbcce52028
parent75153d92a5c02d8eba01c0893f6aff69ad4d2e2b
cmd: mtd: benchmark: use lldiv() instead of 64-bit division

As was noted by Heinrich Schuchardt, some SoCs may not support 64-bit
divisions. Fix an issue by using lldiv() instead.

The code assumes that the benchmark never takes more than 4294 seconds
and thus the difference will be less than U32_MAX.

Also replace (speed / 1024) by (speed >> 10) to avoid potential 64-bit
division.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
cmd/mtd.c