summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2012-01-24 11:51:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-01-25 18:11:45 +0100
commit957535c66fb6dca37c226c440502bddb71aac209 (patch)
tree7249828ba64cb9a6055acda9c4a8cc2fab06733c /lib
parentd3a183c329b6875b59086962a3a2197131e5c39b (diff)
downloadbarebox-957535c66fb6dca37c226c440502bddb71aac209.tar.gz
barebox-957535c66fb6dca37c226c440502bddb71aac209.tar.xz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/show_progress.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/show_progress.c b/lib/show_progress.c
index 333f49868a..39808d2bbc 100644
--- a/lib/show_progress.c
+++ b/lib/show_progress.c
@@ -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)