From: Junio C Hamano Date: Thu, 22 Jan 2026 17:07:40 GMT Subject: Re: [PATCH v2 11/18] git-compat-util.h: introduce `u32_add()` Message-ID: In-Reply-To: <014c01dc8b46$7a2997b0$6e7cc710$@nexbridge.com> 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. has definitions of unsigned_mult_overflows(), and maximum_unsigned_value_of_type(), if you are curious.