git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 14, 2009, 09:13 UTC
Message-ID
<7viqeifie3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4AD578BD.7080201@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 15 quoted lines
> 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
Previous: Johannes Sixt
Message 3 of 3 in “change throughput display units with fast links”
  1. change throughput display units with fast linksNicolas Pitre, Oct 14, 2009
  2. Johannes SixtOct 14, 2009
  3. Junio C HamanoOct 14, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.