show_progress: fix progress bar for files > 32 MiB
The next limit with the current code will probably 2GiB. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
d3a183c329
commit
957535c66f
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <common.h>
|
||||
#include <progress.h>
|
||||
#include <asm-generic/div64.h>
|
||||
|
||||
#define HASHES_PER_LINE 65
|
||||
|
||||
|
@ -38,8 +39,11 @@ void show_progress(int now)
|
|||
return;
|
||||
}
|
||||
|
||||
if (progress_max)
|
||||
now = now * HASHES_PER_LINE / progress_max;
|
||||
if (progress_max) {
|
||||
uint64_t tmp = (int64_t)now * HASHES_PER_LINE;
|
||||
do_div(tmp, progress_max);
|
||||
now = tmp;
|
||||
}
|
||||
|
||||
while (printed < now) {
|
||||
if (!(printed % HASHES_PER_LINE) && printed)
|
||||
|
|
Loading…
Reference in New Issue