summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko2015-05-24 18:01:53 +0200
committerDenys Vlasenko2015-05-24 18:01:53 +0200
commitb878121e76730f7f7e458180363371dbe10fd253 (patch)
tree50db982a77bcf13863802e2626443fbf104357e9 /networking
parent9a595bb36ded308e6d4336aef2c1cd3ac738a398 (diff)
downloadbusybox-b878121e76730f7f7e458180363371dbe10fd253.zip
busybox-b878121e76730f7f7e458180363371dbe10fd253.tar.gz
tc: fix print_rate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/tc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/tc.c b/networking/tc.c
index 533f7c0..76e2e83 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -151,17 +151,17 @@ static void print_rate(char *buf, int len, uint32_t rate)
double tmp = (double)rate*8;
if (use_iec) {
- if (tmp >= 1000.0*1024.0*1024.0)
- snprintf(buf, len, "%.0fMibit", tmp/1024.0*1024.0);
- else if (tmp >= 1000.0*1024)
+ if (tmp >= 1000*1024*1024)
+ snprintf(buf, len, "%.0fMibit", tmp/(1024*1024));
+ else if (tmp >= 1000*1024)
snprintf(buf, len, "%.0fKibit", tmp/1024);
else
snprintf(buf, len, "%.0fbit", tmp);
} else {
- if (tmp >= 1000.0*1000000.0)
- snprintf(buf, len, "%.0fMbit", tmp/1000000.0);
- else if (tmp >= 1000.0 * 1000.0)
- snprintf(buf, len, "%.0fKbit", tmp/1000.0);
+ if (tmp >= 1000*1000000)
+ snprintf(buf, len, "%.0fMbit", tmp/1000000);
+ else if (tmp >= 1000*1000)
+ snprintf(buf, len, "%.0fKbit", tmp/1000);
else
snprintf(buf, len, "%.0fbit", tmp);
}