Re: [PATCH] change throughput display units with fast links

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

 



Johannes Sixt <j.sixt@xxxxxxxxxxxxx> writes:

> Nicolas Pitre schrieb:
>> +	if (rate > 1 << 10) {
>> +		int x = rate + 5;  /* for rounding */
>> +		snprintf(tp->display + sizeof(tp->display) - l, l,
>> +			 " | %u.%2.2u MiB/s",
>
> Shouldn't the fractional part be "%02.2u" (leading zeros instead of blanks)?
>
>> +			 x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
>> +	} else if (rate)
>>  		snprintf(tp->display + sizeof(tp->display) - l, l,
>>  			 " | %u KiB/s", rate);
>>  }
>
> -- Hannes

Judging from the surrounding existing code, I do not think so.

    $ cat <<\EOF >j.c
    #include <stdio.h>

    int main(int ac, char **av)
    {
            printf("%u.%2.2u\n", 4, 5);
            return 0;
    }
    EOF
    $ gcc -o j j.c && ./j
    4.05
--
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]