Subject: Re: [PATCH v2 11/18] git-compat-util.h: introduce `u32_add()`

From: Junio C Hamano <[email-masked]>
Date: Thu, 22 Jan 2026 09:07:40 -0800

<[email-masked]> writes:

>>> This would let the caller handle the failure and is thus quite
>>> flexible, which results in the following code:
>>>
>>> 	if (!u64_mult(expected_size, (uint64_t)p->pack_size, &expected_size))
>>> 		die(_("overflow during fixed-point multiply (%"PRIu64" "
>>> 		      "* %"PRIu64")"), expected_size, (uint64_t)p->pack_size);
>>
>>It does read quite cleanly, so I think I'm convinced.
>
> Are all of these changes endian-safe?

I do not think of any endian-ness issue around here; these "mult"
helpers are checking if the result would overflow using regular
division, without doing any funny byte-shuffling ourselves.
<git-compat-util.h> has definitions of unsigned_mult_overflows(),
and maximum_unsigned_value_of_type(), if you are curious.