mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/6] show_progress: fix progress bar for files > 32 MiB
Date: Tue, 24 Jan 2012 11:51:03 +0100	[thread overview]
Message-ID: <1327402267-22385-3-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1327402267-22385-1-git-send-email-mkl@pengutronix.de>

The next limit with the current code will probably 2GiB.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 lib/show_progress.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/show_progress.c b/lib/show_progress.c
index 333f498..39808d2 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)
-- 
1.7.4.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-01-24 10:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 1/6] net/nfs: increase timeout to 15 seconds Marc Kleine-Budde
2012-01-24 10:51 ` Marc Kleine-Budde [this message]
2012-01-24 10:51 ` [PATCH 3/6] defaultenv: update: add nfs support Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 4/6] ARM: mx3/mx35_3ds: add missing nand device Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 5/6] ARM: mx3/mx35_3ds: increase kernel partition size to 4 MiB Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 6/6] ARM: mx3/mx35_3ds: add (optinal) support for flexcan0 Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327402267-22385-3-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox