Re: [PATCH v6 09/11] pack-objects: shrink size field in struct object_entry
On Mon, Mar 19, 2018 at 5:43 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> +static inline void oe_set_size(struct object_entry *e,
>> + unsigned long size)
>> +{
>> + e->size_ = size;
>> + e->size_valid = e->size_ == size;
>
> A quite similar comment as my earlier one applies here. I wonder if
> this is easier to read?
>
> e->size_valid = fits_in_32bits(size);
> if (e->size_valid)
> e->size_ = size;I wonder if wrapping this "==" with something like this would help readability?
#define truncated(a,b) (a) != (b)
Then we could write
e->size_valid = !truncated(e->size_, size);
--
Duy