From: Junio C Hamano Date: Fri, 16 Mar 2018 21:02:46 GMT Subject: Re: [PATCH v4 11/11] pack-objects.h: reorder members to shrink struct object_entry Message-ID: In-Reply-To: <20180316183200.31014-12-pclouds@gmail.com> Nguyễn Thái Ngọc Duy writes: > Previous patches leave lots of holes and padding in this struct. This > patch reorders the members and shrinks the struct down to 80 bytes > (from 136 bytes, before any field shrinking is done) with 16 bits to > spare (and a couple more in in_pack_header_size when we really run out > of bits). Nice. I am wondering if we need some conditional code for 32-bit platform. For example, you have uint32_t field and do things like this: static inline int oe_size_less_than(const struct object_entry *e, unsigned long limit) { if (e->size_valid) return e->size_ < limit; if (limit > maximum_unsigned_value_of_type(uint32_t)) return 1; return oe_size(e) < limit; } Do we and compilers do the right thing when your ulong is uint32_t?