[PATCH 1/1] Improve progress display in kB range.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When progress.c:throughput_string() is called, the variable total
invariably has its twelve least significant bits set.  Ie, it is
always the case that:

       total & 0xFFF == 0xFFF

As such, there is no point in displaying centi KiB.

Signed-off-by: James Cloos <cloos@xxxxxxxxxxx>
---
 progress.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/progress.c b/progress.c
index 55a8687..e51b834 100644
--- a/progress.c
+++ b/progress.c
@@ -125,9 +125,8 @@ static void throughput_string(struct throughput *tp, off_t total,
 			      (int)(total >> 20),
 			      ((int)(total & ((1 << 20) - 1)) * 100) >> 20);
 	} else if (total > 1 << 10) {
-		l -= snprintf(tp->display, l, ", %u.%2.2u KiB",
-			      (int)(total >> 10),
-			      ((int)(total & ((1 << 10) - 1)) * 100) >> 10);
+		l -= snprintf(tp->display, l, ", %u KiB",
+			      (int)(total >> 10));
 	} else {
 		l -= snprintf(tp->display, l, ", %u bytes", (int)total);
 	}
-- 
1.6.3.rc1.1.g7e8e.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]