Re: [PATCH v2 15/17] midx: use 64-bit multiplication for chunk sizes
- From
Chris Torek <chris.torek@gmail.com>
- Date
- Feb 6, 2021, 20:35 UTC
- Message-ID
- <CAPx1Gvfc9ryYSLJkfej+ryZdbtOtT==EDXpFeSZCBC6=RV6U4w@mail.gmail.com>
- In-Reply-To
- <xmqqwnvmz1pv.fsf@gitster.c.googlers.com>
On Fri, Feb 5, 2021 at 12:41 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Chris Torek <chris.torek@gmail.com> writes: > > There are (still) systems with 32-bit size_t (but 64-bit > > off_t / file sizes), so ... probably not. Is size_t ever more than > > 64 bits these days? > > Sorry, you lost me. I do not see how it would help to perform the > multiplication in uint64_t, when you suspect that size_t is too > small, if the final destination of the result of the multiplication > is a function argument of type size_t?
No, you and Derrick Stolee are right, I wasn't looking out far enough here (to the actual function).
(I was wondering though if there are systems where the valid range for size_t could exceed that for off_t. Are there still systems using 32-bit off_t? Sometimes I think there are too many abstracted types running around here -- how do we know which sizes are big enough? There is always uintmax_t, though, and for unsigned types, ((T)-1) gets you the maximum possible value.)
Chris