Re: [PATCH v2 2/3] strbuf: Add method to convert byte-size to human readable form
- From
Marcus Griep <marcus@griep.us>
- Date
- Aug 15, 2008, 00:53 UTC
- Message-ID
- <48A4D3A7.6080109@griep.us>
- In-Reply-To
- <7viqu3ci5k.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
> 960 bps > 0.9 KiB/s > 2.3 MiB/s
A pedantic note, but bps is bits per second, whereas Bps or B/s is bytes per second. Requiring the same suffix for each would prevent some easily overlooked issues like this.
Show 5 quoted lines
> I also am not particularly happy about using "double" in this API. Most > of the callers that gather stats in the rest of the codebase count in > (long) integers as far as I can tell, and it may be conceptually cleaner > to keep the use of double as an internal implementation issue of this > particular function.
The function requires the use of a double for fractional parts, so letting the compiler perform an upcast were necessary seems innocuous to me.
Also, Yibi-/Zibi-, unlikely to be used as they are, won't fit in a long.
-- Marcus Griep GPG Key ID: 0x5E968152 —— http://www.boohaunt.net את.ψο´