[git commit master 1/1] libbb: make warning go away

Denys Vlasenko vda.linux at googlemail.com
Sat Mar 12 01:19:50 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=8345b2bd5ea28bd8d07886e615b9c2d5ab35477d
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/progress.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libbb/progress.c b/libbb/progress.c
index df43dad..372feb0 100644
--- a/libbb/progress.c
+++ b/libbb/progress.c
@@ -127,10 +127,12 @@ void FAST_FUNC bb_progress_update(bb_progress_t *p,
 		/* 32-bit CPU and 64-bit off_t.
 		 * Use a 40-bit shift, it is easier to do on 32-bit CPU.
 		 */
-		if (totalsize >= (uoff_t)(1ULL << 54)) {
-			totalsize = (uint32_t)(totalsize >> 32) >> 8;
-			beg_size = (uint32_t)(beg_size >> 32) >> 8;
-			transferred = (uint32_t)(transferred >> 32) >> 8;
+/* ONE suppresses "warning: shift count >= width of type" */
+#define ONE (sizeof(off_t) > 4)
+		if (totalsize >= (uoff_t)(1ULL << 54*ONE)) {
+			totalsize = (uint32_t)(totalsize >> 32*ONE) >> 8;
+			beg_size = (uint32_t)(beg_size >> 32*ONE) >> 8;
+			transferred = (uint32_t)(transferred >> 32*ONE) >> 8;
 			kiloscale = 4;
 		}
 	}
-- 
1.7.3.4



More information about the busybox-cvs mailing list