tc: fix print_rate
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 24 May 2015 16:01:53 +0000 (18:01 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 24 May 2015 16:01:53 +0000 (18:01 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/tc.c

index 533f7c04226e870298ec07312ba22935c8cfed24..76e2e83599bfd2a2576e446e7950ccdeac9de4a1 100644 (file)
@@ -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);
        }