9
0
Fork 0

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:
Marc Kleine-Budde 2012-01-24 11:51:03 +01:00 committed by Sascha Hauer
parent d3a183c329
commit 957535c66f
1 changed files with 6 additions and 2 deletions

View File

@ -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)