Re: [PATCH] diff: use 64-bit integers for diffstat calculations
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 17, 2010, 17:00 UTC
- Message-ID
- <7vvdbq2ev7.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20100417102543.GB23110@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> Yuck, we use "unsigned int" for the actual storage, and then convert to > a regular "int" in some other places. I think we should just do this: > > -- >8 -- > Subject: [PATCH] diff: use 64-bit integers for diffstat calculations > > The diffstat "added" and "changed" fields generally store > line counts; however, for binary files, they store file > sizes. Since we store and print these values as ints, a > diffstat on a file larger than 2G can show a negative size. > Instead, let's explicitly use 64-bit integers. > > Signed-off-by: Jeff King <peff@peff.net> > ---
Yes, but we would probably be better off using using uintmax_t for things like this if the quantity a variable represents is not closely tied to external file format (e.g. the offset field of pack idx file), nor the code is only for a particular platform (e.g. compat/win32mmap.c), don't you think?
That is the impression I am getting on the discipline expressed in the current codebase, from browsing the output from "git grep uint64_t".